[Xcb] A simple question on XCBGCFunction [SOLVED]

Jamey Sharp jamey at minilop.net
Sun Jun 11 14:39:26 PDT 2006


On Sun, Jun 11, 2006 at 12:48:42PM -0700, Barton C Massey wrote:
> The util library should probably contain vararg functions
> for this sort of case that take lists of some kind of
> struct.  C is putrid.

How do varargs help? Ian's approach in XCBAux is already pretty nice.

I suppose I could see using varargs for "name"/value pairs:

fill(&mask, &array,
	XCBGCForeground, screen->white_pixel,
	XCBGCFunction, XCBGXxor,
	0);

Implementing this would require sorting the arguments, however, while
Ian's (and Xlib's) structure-based approach ensures that the values are
kept in the right order by the compiler.

> BTW, is auto array initialization legal old ANSI C?

GCC in C89 mode issues a warning for non-constant array initializer
elements, but if all the elements are computable at load time then it is
warning-free. In C99 mode it is warning-free no matter what. In either
case GCC generates correct code, but I suppose this behavior should not
be relied on in portable code.

--Jamey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://lists.freedesktop.org/archives/xcb/attachments/20060611/1600f0b5/attachment.pgp


More information about the Xcb mailing list