Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!jarthur!nntp-server.caltech.edu!gap!manning From: manning@gap.caltech.edu (Evan Marshall Manning) Newsgroups: comp.lang.c Subject: Re: Using Macros Message-ID: Date: 7 Aug 90 17:58:55 GMT References: <14339@shlump.nac.dec.com> Sender: news@laguna.ccsf.caltech.edu Organization: California Institute of Technology Lines: 48 farrell@onedge.enet.dec.com (Bernard Farrell) writes: >In article <362.26be9dcc@astro.pc.ab.com>, yoke@astro.pc.ab.com (Michael Yoke) writes... >(Some earlier statments removed) >>But, if I define the macro like this >> >> #define A_MACRO { stmt1; stmt2; } >> >>then the semi-colon at the end of the macro reference screws things up. >> > When used in > for (something) > A_MACRO; >Michael, the macro expansion would give you: > for (something) > { > stmt1; > stmt2; > }; >[Indentation is mine for clarity]. The presence of an empty statement after >the closing brace should not cause any problems, though I seem to recall >certain C compilers don't like it being placed here. I believe the fun variant is: if (something) A_MACRO; else it_doesn_t_matter; Try nesting the ifs for more fun! Gimple Lint will catch this type of errors, as unusual indentation. -- Evan *************************************************************************** Your eyes are weary from staring at the CRT for so | Evan M. Manning long. You feel sleepy. Notice how restful it is | is to watch the cursor blink. Close your eyes. The |manning@gap.cco.caltech.edu opinions stated above are yours. You cannot | manning@mars.jpl.nasa.gov imagine why you ever felt otherwise. | gleeper@tybalt.caltech.edu