Gtk--: Why does this (specific code) compile at all?
- From: Robert_Gasch/PeopleSoft peoplesoft com
- To: gtk-list redhat com
- Subject: Gtk--: Why does this (specific code) compile at all?
- Date: Fri, 16 Apr 1999 13:33:52 +0200
I may have a perfectly obvious question, but the answer eludes me and
my (simplistic) understanding of C++:
In my program, I do the following:
Gtk_VBox vbox (TRUE, 5);
win.add (vbox); // OK
so far so good ... my original code though said:
win.add (&vbox); // note the extra '&'
while compiles fine (without warnings), but in my
experience is wrong (and I suspect this line of causing
a core dump under certain OSs).
Now looking at the Gtk-- header files, add() seems to expect
a reference as the first argument:
void add (Gtk_Widget &child, ...)
As thus my question is: why does this compile at all? Shouldn't
the compiler flag the passing of the vbox pointer as a type
] [Thread Prev