Article View: comp.std.c
Article #2328functions within functions
From: Garry Wiegand
Date: Tue, 22 Jan 1991 08:10
Date: Tue, 22 Jan 1991 08:10
35 lines
1476 bytes
1476 bytes
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.)
So I'm guessing that if they thought about it they must have decided
not to break old compilers that were strongly "moded" inside. Or
that there was some theological argument. Does anyone know?
Put it on the list for next time.
(The prohibition in C++ seems silly considering that a simple wrapper:
void outside(void) {
class wrapper {public:
static void inside(void){}
};
wrapper::inside();
}
turns it into a legal program.)
Garry Wiegand --- Ithaca Software, Alameda, California
...!uunet!ithaca!garry, garry%ithaca.uucp@uunet.uu.net
Technical Details
Message-ID:
<1991Jan22.081057.8567@ithaca.uucp>Path:
arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!hybrid!scifi!bywater!uunet!ithaca!garryShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!censor!geac!torsqnt!hybrid!scifi!bywater!uunet!ithaca!garry From: garry@ithaca.uucp (Garry Wiegand) Newsgroups: comp.std.c,comp.std.c++ Subject: functions within functions Message-ID: <1991Jan22.081057.8567@ithaca.uucp> Date: 22 Jan 91 08:10:57 GMT Organization: Ithaca Software Lines: 35