On Thu, 29 Sep 2011 22:57:25 +0530, Nilesh Govindarajan wrote about
[gentoo-user] Strange GCC behavior:

> Default function arguments in C are specified like this:
> 
> int func(int a = 10) {} // just a dummy function
> 
> Now I save that in a file called foo.c
> 
> The above piece of code is valid in C as well as C++

Not in C90.  The default grammar does not permit default values for
arguments in C, only C++.

> Why is this happening? O_o

Try adding -std=gnu99 as a compiler switch.  That switches the grammar
from C90 to C99, with Gnu extensions too.
-- 
Regards,

Dave  [RLU #314465]
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
[email protected] (David W Noon)
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

Attachment: signature.asc
Description: PGP signature

Reply via email to