Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site sdcrdcf.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!ittvax!dcdwest!sdcsvax!sdcrdcf!brad From: brad@sdcrdcf.UUCP (Brad Spear) Newsgroups: net.lang.c Subject: Re: on1 construct Message-ID: <1449@sdcrdcf.UUCP> Date: Wed, 7-Nov-84 15:18:08 EST Article-I.D.: sdcrdcf.1449 Posted: Wed Nov 7 15:18:08 1984 Date-Received: Fri, 9-Nov-84 08:58:48 EST References: <124@cadvax> <1448@sdcrdcf.UUCP> Reply-To: brad@sdcrdcf.UUCP (Brad Spear) Organization: System Development Corp. R+D, Santa Monica Lines: 28 Summary: Silly me. If I had thought about it for 10 more minutes, I would have had a better version the first time. In this case, the _f doesn't have to be negated every time. I thought I had ruled this case out, but I made a mistake somewhere originally, and it does work. Note that it depends on the fact that "_f" is evaluated before "!(_f=FALSE)", which is what C is supposed to guarantee. #define ON_FIRST_TIME static char _f = TRUE; if (_f && !(_f=FALSE)) This expression can be used like: { declarations ... ON_FIRST_TIME { blah1, blah1, blah1 ... } blah2, blah2, blah2 ... } It will cause "blah1, blah1, blah1 ..." to be executed the first time only. It would be nice if someone could figure out how to make a non-function block return a value, then the expression could go anywhere, and the _f could be totally invisible. Brad Spear sdcrdcf!brad