On Monday 24 March 2003 23:57, you wrote: > Hi! > > I am looking for information on the behavior of ANSI C while compiling > the following method: > > int f1(int a) { > int a = a; > return a; > } > > > in the current versions of gcc this compiles, and shadowing of the given > a is allowed within the function. > If i am not mistaken - this in not so in ANSI C [i might be mistaken... > the ritchie&ker. book is not so clear about this point] > > how compliant is gcc with ansi? >
Tal!!! A few notes: 1. info gcc will give you *** hundreds *** of pages documenting the compiler. 2. gcc is much more standards compliant than any compiler I have ever seen. 3. check out the -ansi flag to gcc. 4. check out the -std flag to gcc. 5. I recommend you do even more and pass compilation with the -Wall -Werror flags. 6. man gcc and the -W flags there. Have fun!!! P.S. Ritchie and Kerninghan didn't even dream of GCC when they thought of C so the small book is of little use these days. Mark. BTW: I know of many people who whould screm bloody murder if GCC didn't allow the previous example to compile. The GCC team chose (for good and evil) to be quite permissive when compiling without flags and enable a user that wants protection to get it by passing certain flags to the compiler. It's debatable whether this descision is correct but it's quite obvious that whatever the descision would have been there would have been people who would screem bloody murder about it....:) > > thanks, > Tal Achituv -- Name: Mark Veltzer Title: Research and Development, Meta Ltd. Address: Habikaa 17/3, Kiriat-Sharet, Holon, Gush-Dan, Israel 58495 Phone: +972-03-5508163 Fax: +972-03-5508163 Email: mailto:[EMAIL PROTECTED] Homepage: http://www.veltzer.org OpenSource: CPAN, user: VELTZER, mailto:[EMAIL PROTECTED], url: http://search.cpan.org/author/VELTZER/ Public key: http://www.veltzer.org/ascx/public_key.asc, wwwkeys.pgp.net, 0xC71E5D38 ================================================================To unsubscribe, send mail to [EMAIL PROTECTED] with the word "unsubscribe" in the message body, e.g., run the command echo unsubscribe | mail [EMAIL PROTECTED]