This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Compiling functions without return type.


amol jakatdar <ajakatda@cs.odu.edu> writes:

> Hi,
> 
> is there a way to compile following code using g++:
> 
> #include <stdio.h>
> 
> f();  // Function defination w/o return type
> 
> int main(int argc, char *argv[])
> {
>         f();
>         return 0;
> }
> 
> f()
> {
>         printf("%d",1);
>         return 0;
> }
> 
> I know this is against ANSI standards, but I have some header files,
> defining functions like this.
> 
Try -fpermissive .
I know a few people who have used -fpermissive to build stuff like gtk
  on solaris (which has many many lines of non-compliant code like the
  above in its old X11 headers) .

Of course, it is best to fix the code, since the C99 (new ANSI C
  standard) makes k & r style function defs errors.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]