Nima Hoda wrote: > But it's not a null pointer constant that the spec calls for but > rather NULL itself: > > Each procedure named XtVasomething takes as its last arguments ... > a variable parameter list of resource name and value pairs where > each name is of type String and each value is of type XtArgVal. > The end of the list is identified by a name entry containing NULL. > > --X Toolkit Intrinsics - C Language Interface (pg.44) [1] >
Sorry to reply to myself, but I did a bit more research. Looking at the code in Xt functions that process variadic arguments, they generally look like this: for(attr = va_arg(var, String) ; attr != NULL; attr = va_arg(var, String)) { if (strcmp(attr, XtVaTypedArg) == 0) { typed_arg.name = va_arg(var, String); typed_arg.type = va_arg(var, String); . . . --from xenocara/lib/libXt/src/Varargs.c line 368 So, the list-ending argument must have the same size as String, which is typedef as char * (in Intrinsic.h) and it must have the null pointer value (since it's compared to NULL in pointer context). However, the source you sent me on null pointers states that ...there is a null pointer for each pointer type, and the internal values of null pointers for different types may be different. Although programmers need not know the internal values, the compiler must always be informed which type of null pointer is required, so that it can make the distinction if necessary. --http://www.c-faq.com/null/null1.html Then shouldn't the correct value for the final argument be (String)NULL as (void *)NULL may have a different internal representation? That said, I took a broad sampling through the xenocara tree for variadic Xt calls and with very few exceptions the list-ending argument used is NULL. The one exception that I found was in the xterm code which uses (XtPointer) 0. So, I'm really not sure which is correct anymore. -Nima