GAny (and 64-bit architectures)



Beating a dead horse...

>>>>> "Owen" == Owen Taylor <owt1@cornell.edu> writes:

[SNIP]

    >> >void
    >> >callback (GtkWidget *widget, GtkWidget *some_other_widget)
    >> >{
    >> >....
    >> >}
    >> >
    >> >gtk_signal_connect (GTK_OBJECT (button), "clicked",
    >> >callback, widget_x);
    >> >
    >> >Is _not_ better written as:
    >> >
    >> >void
    >> >callback (GtkWidget *widget, GAny any)
    >> >{
    >> >GtkWidget *widget = any.p;
    >> >}
    >> >
    >> >GAny any;
    >> >any.p = widget_x;
    >> >gtk_signal_connect (GTK_OBJECT (button), "clicked",
    >> >callback, any);
    >>
    >> How is that worse? Demands a little more writing?

    Owen> "Demands more writing" is definitely a problem when the code
    Owen> is one of the most frequent things done in a GTK program.

    Owen> It also is is less clear - not only are there more complexities
    Owen> to deal with, but the important stuff is spread out.

But this is not even needed... if I'm not completely mistaken,

  gtk_signal_connect(GTK_OBJECT (button), "clicked", callback, (GAny)widget_x);

should work just as well (at least gcc 2.8.0 doesn't produce warnings
for such code... even with -Wall -W).

And the `widget = any.p' in `callback' wouldn't be necessary
either... just `widget = (GTKWidget)any' would be enough (which one
should do anyway when assigning from a `void *', as this says "Yes, I
know what I'm doing").

I'd really like to see this... as it'd give me a greater feeling of
security in regard to 64-bit machines... I didn't work on one (yet),
but from I've read on this list (and others, like the GIMP list),
sizes of data types might really not be what you expect... even on the
same machine.  This GAny would take (IMHO) a lot of stress out of this
situation...

[SNIPPED all the rest]

Bye, J



--
Jürgen A. Erhard  eMail: jae@laden.ilk.de  phone: (GERMANY) 0721 27326
   MARS: http://members.tripod.com/~Juergen_Erhard/mars_index.html
		   "Ever wonder why the SAME PEOPLE
     make up ALL the conspiracy theories?" -- Michael K. Johnson



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