Re: [gtk-list] Re: Why doesn't GTK+...



On Fri, 16 Jul 1999, Jan Kratochvil wrote:

> > GTK+ allows one argument for functions like gtk_signal_connect()... why doesn't it allow multiple arguments using ellipses (...) as an argument? This could fit in many places, such as gtk_slist_append(), allowing you to append more than one thing at a time.
> 
>   You can't technically pass "..." argument - in the next call it MUST be passed
> as va_list argument. And as you can't benefit from "...", for va_list passing
> (which is sometimes also useful) you can use standard gtk_signal_connect()
> as va_list is a pointer which can be casted to "gpointer".

va_list is differently implemented on different systems. it is sometimes a
pointer (typed or void), sometimes a structure, or even an array. this is why
glib/gtk never pass va_lists by reference (e.g. casted into a pointer or by
taking its adress), since that's simply not portable.

btw, glib used to do this, and we had to change a bunch of code to get rid of
the involved portability problems:

Mon Aug 24 02:08:56 1998  Tim Janik  <timj@gtk.org>

	[...]

        * configure.in: check for va_copy() or __va_copy() alternatively.
        check whether va_lists can be copyied by value.

        * glib.h: provide a definition for G_VA_COPY.

        * glib.h:
        * gmessages.c:
        (g_logv):
        (g_vsnprintf):
        pass va_lists by value, not by reference, since this causes problems
        on platforms that implement va_list as as arrays. internaly, use
        G_VA_COPY (new_arg, org_arg); va_end (new_arg); to produce a second
        va_list variable, if multiple passes are required. changed all
        callers.


> 
>   							Lace
> 

---
ciaoTJ



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]