Re: batching gets and searching



I believe ISO C makes no distinction between enum values and
signed ints. C++ requires a cast to accept an int value as
an enum. ORing together enum values is one kind of arithmetic
operation that results in an int value, so E_X | E_Y where
an enum is expected requires a cast.

>Delivered-To: gconf-list gnome org
>To: Havoc Pennington <hp redhat com>
>Cc: Colm Smyth <Colm Smyth ireland sun com>, gconf-list gnome org
>Subject: Re: batching gets and searching 
>From: Dan Winship <danw helixcode com>
>X-BeenThere: gconf-list gnome org
>X-Loop: gconf-list gnome org
>X-Mailman-Version: 2.0beta5
>List-Id: Discussion of the GConf library <gconf-list.gnome.org>
>
>> In C enums simply are not distinct types from int, so there's no
>> additional violation; in C++ the result of a bunch of enum values |'d
>> together is not typesafe in the same sense void* isn't.
>
>I'm pretty sure ANSI C doesn't guarantee that variables of enum type
>can hold integer values that don't correspond to members of the
>enumeration. (Not that you'll ever find a compiler that won't allow
>this.)
>
>-- Dan
>
>_______________________________________________
>Gconf-list mailing list
>Gconf-list gnome org
>http://mail.gnome.org/mailman/listinfo/gconf-list

--
Colm Smyth - Sun Microsystems, Ireland - Desktop S/W Engineering
Sun Xtn: 19166    Phone: 353-1-819-9166   Fax: 353-1-819-9200





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