[cairo] Cleaning up cairo-features.h
Owen Taylor
otaylor at redhat.com
Sat May 7 09:28:34 PDT 2005
On Fri, 2005-05-06 at 23:48 -0400, Carl Worth wrote:
> For some time, the definitions in cairo-features.h have bugged me a
> bit. With what we've had, if one wanted to test for the presence of a
> backend, (say xlib), then one would use:
>
> #ifdef CAIRO_HAS_XLIB_SURFACE
>
> and in the (basically useless) case of testing for the absence:
>
> #ifdef CAIRO_HAS_NO_XLIB_SURFACE
>
> and this achieved by a simple #define for one macro or the other in
> cairo-features.h.
>
> I think that the macros would be much more readable if used as:
>
> #if CAIRO_HAS_XLIB_SURFACE
>
> which consequently means they should be defined unconditionally, but
> to either a 1 or a 0 to indicate presence or absence.
Is there really a benefit from deviating from the standard
of:
#define CAIRO_HAS_XLIB_SURFACE 1
vs.
/* Nothing */
In addition to being standard, that allows all four of:
#if CAIRO_HAS_XLIB_SURFACE
#if !CAIRO_HAS_XLIB_SURFACE
#ifdef CAIRO_HAS_XLIB_SURFACE
#ifndef CAIRO_HAS_XLIB_SURFACE
While with the definition you propose above, the #ifdef and
#ifndef don't work. (Silently do the wrong thing)
Regards,
Owen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050507/d075234e/attachment.pgp
More information about the cairo
mailing list