macors and semicolons

Doug Gwyn gwyn at smoke.brl.mil
Tue Jun 25 02:53:47 AEST 1991


In article <1991Jun24.213932.595 at otago.ac.nz> andrew at 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)



More information about the Comp.std.c mailing list