Re: [gtk-list] Re: C++ and gtk.
- From: Guillaume Laurent <glaurent worldnet fr>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Re: C++ and gtk.
- Date: 26 Apr 1999 12:56:20 +0200
pavel <pavel@klebanov.ne.mediaone.net> writes:
> Fair enough. However, it seems illogical (even symantically incorrect) to
> me that gtk_table_attach() takes a GtkAttachOption and not an int (just
> like it used to be until recently).
> Afterall, EXPAND|SHRINK is an int and not a GtkAttachOption.
No, but it can be used to init a GtkAttachOption.
> Besides, while I don't know the particulars of compiler behavior, it
> seems quite feasible to me that casting an int to a GtkAttachOption
> may result in a 1 or 2 or a 4 (i.e. a GtkAttachOption) and not, say,
> 5 as desired.
No. Quoting Stroustrup's TC++PL 3rd ed (#4.8) : "The range of an
enumeration holds all the enumeration's enumerator values rouded up to
the nearest larger binary power minus 1".
So while
GtkAttachOption a = 5;
is incorrect
GtkAttachOption a = GtkAttachOption(EXPAND|SHRINK);
is correct and guaranteed to give the expected result.
> Any any case, what was the rationale behind changing an int to a
> GtkOption?
I'd assume code readability.
--
Guillaume.
http://www.worldnet.fr/~glaurent
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]