Re: private functions



On Sat, 31 May 2008 12:49:01 -0400, CBFalconer wrote:
Because you were using a non-standard extension of gcc. Local functions
are forbidden in standard C. If you run gcc properly (with gcc -W -Wall
-ansi -pedantic) so that it restricts itself to standard C, it will
reject that program too.

That's just plain wrong. If you had actually bothered to try it, you would
have found that gcc with your recommended options accepts the original
code (as permitted).

$ gcc -W -Wall -ansi -pedantic testit.c -o testit
testit.c: In function ‘main’:
testit.c:5: warning: ISO C forbids nested functions
testit.c:10: warning: ISO C forbids nested functions
testit.c:18: warning: control reaches end of non-void function
$ ./testit
12

Implementations aren't required to reject code with syntax errors or
constraint violations. GCC with your recommended options doesn't. This is
intentional, conforming, and documented.
.



Relevant Pages

  • Re: Raw Convertors
    ... GCC is compliant to which version of the US standard? ... ISO C90 as modified in amendment 1. ... ISO C99 plus GNU extensions. ...
    (rec.photo.digital)
  • Re: Raw Convertors
    ... GCC is compliant to which version of the US standard? ... ISO C90 as modified in amendment 1. ... ISO C99 plus GNU extensions. ...
    (rec.photo.digital)
  • Re: [C99F] How many levels of pointers can you have?
    ... The problem is pragmatically speaking the Gcc dialect is very ... I thought one of ANSI or ISO adopted the C standard in 1989 and the ... ANSI produced the first C standard in 1989. ...
    (comp.lang.c)
  • Re: [C99F] How many levels of pointers can you have?
    ... The problem is pragmatically speaking the Gcc dialect is very ... I thought one of ANSI or ISO adopted the C standard in 1989 and the ... When a reference to C90 is made in this newsgroup, does it mean ANSI C ...
    (comp.lang.c)
  • Re: private functions
    ... If you run gcc properly ... to standard C, it will reject that program too. ... testit.c:10: warning: ISO C forbids nested functions ...
    (comp.lang.c)