[gecode-users] making macros safe for semicolons

Guido Tack tack at ps.uni-sb.de
Tue Dec 16 17:52:28 CET 2008


Denys Duchier wrote:

> I had a couple of problems using some of Gecode macros because they
> cannot all be safely followed by a semicolon.  Here is a proposed  
> patch
> that uses de "do {...} while (0)" pattern to make these macros safe.
> This is an old trick that is used a great deal in the Linux kernel.

Right, it's even mentioned in the cpp documentation:
http://gcc.gnu.org/onlinedocs/gcc-3.2.3/cpp/Swallowing-the-Semicolon.html

Thanks, it's in the trunk now.

Cheers,
	Guido





More information about the gecode-users mailing list