
December 25th, 2012, 03:56 PM
|
 |
Contributed User
|
|
|
|
> "ISO C forbids nested functions"
Like the message says, nested functions are not part of ISO C.
GCC allows it (but then again, unconstrained GCC allows a lot of things).
Nested functions look like this
Code:
void foo ( ) {
int bar ( ) {
return 42;
}
int res = bar();
}
In ISO C, do this
Code:
int bar ( ) {
return 42;
}
void foo ( ) {
int res = bar();
}
The only issue is the scope of bar, which in the former case is just the foo function, and in the latter, its the whole file.
|