Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site cadvax Path: utzoo!linus!decvax!decwrl!amd!resonex!cae780!ubvax!megatest!cadvax!jacob From: jacob@cadvax (Jacobo Bulaevsky) Newsgroups: net.lang.c Subject: on1 construct Message-ID: <124@cadvax> Date: Thu, 1-Nov-84 20:22:23 EST Article-I.D.: cadvax.124 Posted: Thu Nov 1 20:22:23 1984 Date-Received: Tue, 6-Nov-84 08:00:35 EST Reply-To: jacob@cadvax.UUCP (Jacobo Bulaevsky) Organization: Megatest Corp., San Jose, CA Lines: 49 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