[cairo] On #if vs #ifdef

Bill Spitzak spitzak at d2.com
Thu Mar 22 07:26:28 PDT 2007

Behdad Esfahbod wrote:
> The following message from FreeType list may be helpful deciding between
> #if vs #ifdef...  Again, "#if FOO+0" is a third option that doesn't have
> most problems of those two.

> So "#if FOO, where FOO is undefined" is ok with GNU cpp [2] but not with Visual C++ [3]
> I haven't looked at other compilers, but I wouldn't be surprised to see that this is
> a GNU-specific extension, or it may come from a tradition of various Unix pre-processors,
> but certainly can't be generalized...

I'm pretty certain this works in Visual C++, or I would have noticed a 
long time ago, as our code is full of these. It also works in the Irix 
and Intel compilers.

More information about the cairo mailing list