on1 construct
Jacobo Bulaevsky
jacob at cadvax
Fri Nov 2 11:22:23 AEST 1984
I've started functions in the following way:
function ()
{
static char first_time_in = TRUE;
if (first_time_in) {
first_time_in = FALSE;
bla, bla, bla...
};
etc...
}
One contruct that I've always wanted to have is:
function ()
{
on1 {
bla, bla, bla...
};
etc...
}
I've been trying to define a macro to do this but haven't been succesful.
What I've come up with looks like:
#define on1(X) static char first_time_in = TRUE; if (first_time_in) {first_time_in = FALSE; X;}
But unfortunately this macro has to be used like:
on1 (
bla, bla, bla...
);
which is VERY inappropriate. Can anybody out there think of a better
macro definition, comments, suggestions?
Thanks in advance.
Jacobo Bulaevsky
--
UUCP: {decvax!decwrl, ucbvax, ihnp4} !sun!megatest!jacob
{lbl-csam, amd, ubvax} !megatest!jacob
ARPA: megatest!jacob@{Glacier||Shasta}.ARPA
USMAIL: Megatest; 880 Fox Lane; San Jose, Ca 95131
PHONE: (408)998-7110 x 3171
More information about the Comp.lang.c
mailing list