Gentoo Archives: gentoo-user

From: Nilesh Govindarajan <contact@××××××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Strange GCC behavior
Date: Thu, 29 Sep 2011 17:55:09
Message-Id: 4E84B0BC.1090809@nileshgr.com
In Reply to: Re: [gentoo-user] Strange GCC behavior by Todd Goodman
1 On Thu 29 Sep 2011 11:13:54 PM IST, Todd Goodman wrote:
2 > * Nilesh Govindarajan <contact@××××××××.com> [110929 13:33]:
3 >> Default function arguments in C are specified like this:
4 >>
5 >> int func(int a = 10) {} // just a dummy function
6 >
7 > No they're not. C doesn't have default function arguments.
8 >
9 >>
10 >> Now I save that in a file called foo.c
11 >>
12 >> The above piece of code is valid in C as well as C++
13 >
14 > Uh, no it's not.
15 >
16 >>
17 >> Why is this happening? O_o
18 >
19 > Because it's not correct C.
20 >
21 > Todd
22
23 Gah! so that's the reason. I've been coding C++ and other languages
24 with default arguments that I forgot C.
25
26 --
27 Nilesh Govindarajan
28 http://nileshgr.com