Gentoo Archives: gentoo-user

From: David W Noon <dwnoon@××××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Strange GCC behavior
Date: Thu, 29 Sep 2011 18:02:53
Message-Id: 20110929190038.25a57407@karnak.local
In Reply to: [gentoo-user] Strange GCC behavior by Nilesh Govindarajan
1 On Thu, 29 Sep 2011 22:57:25 +0530, Nilesh Govindarajan wrote about
2 [gentoo-user] Strange GCC behavior:
3
4 > Default function arguments in C are specified like this:
5 >
6 > int func(int a = 10) {} // just a dummy function
7 >
8 > Now I save that in a file called foo.c
9 >
10 > The above piece of code is valid in C as well as C++
11
12 Not in C90. The default grammar does not permit default values for
13 arguments in C, only C++.
14
15 > Why is this happening? O_o
16
17 Try adding -std=gnu99 as a compiler switch. That switches the grammar
18 from C90 to C99, with Gnu extensions too.
19 --
20 Regards,
21
22 Dave [RLU #314465]
23 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
24 dwnoon@××××××××.com (David W Noon)
25 *-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*

Attachments

File name MIME type
signature.asc application/pgp-signature