[cairo] Adding a boolean type
Carl Worth
cworth at redhat.com
Tue Feb 1 06:15:07 PST 2005
On Mon, 31 Jan 2005 19:02:45 -0500, Owen Taylor wrote:
> What if we add:
>
> typedef char cairo_bool_t;
> #define CAIRO_FALSE 0
> #define CAIRO_TRUE 1
Where do you propose adding these? The cairo_bool_t would be useful in
the public header to make the behavior of any predicates more
apparent, (I think cairo_in_stroke and cairo_in_fill are all we have
so far). But it doesn't necessarily follow that the TRUE/FALSE defines
need also be public. They're certainly never useful for testing return
values from functions, (only in generating those values).
> char vs. int: For Glib we picked int, to reduce the risk of
> 'GBoolean bool = flags & FLAG' traps, but mostly it doesn't matter,
> and char seems to be more common in general.
That's a scary trap. What are the arguments in favor of char? I can't
think of any real ones, and I haven't seen any in this thread.
My inclination would be:
cairo.h:
typedef int cairo_bool_t;
cairoint.h:
#define FALSE 0
#define TRUE 1
-Carl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20050201/8314008c/attachment.pgp
More information about the cairo
mailing list