Xref: utzoo comp.std.c:4983 comp.lang.c:40399 Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!ncar!hsdndev!cmcl2!adm!smoke!gwyn From: gwyn@smoke.brl.mil (Doug Gwyn) Newsgroups: comp.std.c,comp.lang.c Subject: Re: macors and semicolons Message-ID: <16519@smoke.brl.mil> Date: 24 Jun 91 16:53:47 GMT References: <1991Jun24.213932.595@otago.ac.nz> Followup-To: comp.lang.c Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 9 In article <1991Jun24.213932.595@otago.ac.nz> andrew@otago.ac.nz writes: >#define SWAP(a, b) {int c; c = a; a = b; b = c} >how do I define a swap macro that swaps two doubles, allows the ';' on the end >of the macro call, but does not cause a systax error when used in this context? This is not a C standards question. One obvious general solution is: #define MACRO(args) do { /*...*/ } while(0)