Re: private functions
- From: Harald van Dijk <truedfx@xxxxxxxxx>
- Date: Sat, 31 May 2008 20:51:49 +0200
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.
.
- References:
- private functions
- From: Ronald Bruck
- Re: private functions
- From: CBFalconer
- private functions
- Prev by Date: Re: function
- Next by Date: Re: function
- Previous by thread: Re: private functions
- Next by thread: struct padding ???
- Index(es):
Relevant Pages
|