Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site murdu.OZ Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!mulga!munnari!murdu!prl From: prl@murdu.OZ (Peter Lamb) Newsgroups: net.lang.c Subject: Re: on1 construct Message-ID: <159@murdu.OZ> Date: Thu, 8-Nov-84 14:42:52 EST Article-I.D.: murdu.159 Posted: Thu Nov 8 14:42:52 1984 Date-Received: Fri, 9-Nov-84 08:48:57 EST References: <124@cadvax>, <4594@fortune.UUCP> Organization: Melbourne Uni, Australia Lines: 32 [] A nice way to put on1 in is to avoid the text of the on1 being part of the macro. This involves a pretty grotty-looking if (with side-effects) so if you want to keep pure, read no further: #define on1 static int _not1_ = 0; if(!_not1_ && (_not1_ = 1)) then on1 has EXACTLY the same behavior as the if, except that it must be the first statement unless the whole lot is covered by {}'s. eg: on1 do_this(); else do_that(); or: on1 { blah, blech; blah; } If you don't want the on1 code as the first `executable' statement then { on1 do_this(); else do_that(); } will get you out of trouble, albeit inelegantly. Peter Lamb, ......!decvax!mulga!prl University of Melbourne Parkville 3052 Australia