Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!linus!philabs!cmcl2!seismo!brl-tgr!gwyn From: gwyn@brl-tgr.ARPA (Doug Gwyn ) Newsgroups: net.lang.c Subject: Re: on1 construct Message-ID: <5631@brl-tgr.ARPA> Date: Wed, 7-Nov-84 11:29:49 EST Article-I.D.: brl-tgr.5631 Posted: Wed Nov 7 11:29:49 1984 Date-Received: Sat, 10-Nov-84 04:02:48 EST References: <124@cadvax> Organization: Ballistic Research Lab Lines: 34 > 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. Try: #define on1 static long on1_flag = 0L; if ( on1_flag++ == 0L ) There are other tricks if you don't like this one. Remember, the condition inside the "if" parentheses can accomplish as many side actions as desired.