functions within functions

Roy Johnson rjohnson at shell.com
Fri Feb 1 04:27:39 AEST 1991


In article <70282 at microsoft.UUCP> jimad at microsoft.UUCP (Jim ADCOCK) writes:
>In article <1991Jan22.081057.8567 at ithaca.uucp> garry at ithaca.uucp (Garry Wiegand) writes:
>|When the C standards committee was meeting, did they discuss allowing 
>|the declaration of functions within functions? Ie, making:
>|
>|> void outside(void) { 
>|> 	static void inside(void) {}
>|>> 	inside(); 
>|> }
>|
>|count as legal C? Neither my quasi-Ansi C nor my g++ compiler will
>|accept it.
>|
>|The name-space advantages should be obvious, and as far as I can
>|see the syntax and semantics are clear and unambiguous, with no
>|unfortunate side effects. (Except: I'm not sure if the word "static"
>|would have any meaning in the context.)  

If you're worried about the namespace, just make different code
modules, where the outside() is available to the other modules,
and inside() is only available within outside()'s module.

--
======= !{sun,psuvax1,bcm,rice,decwrl,cs.utexas.edu}!shell!rjohnson =======
"If he exploded, all of Manhattan would be talking in high, squeaky voices
for months!"  "Cool." -- When I Was Short
Roy Johnson, Shell Development Company



More information about the Comp.std.c mailing list