Ouch?
David Leimbach
leimy2k at mac.com
Fri Feb 20 02:51:02 GMT 2004
On Feb 19, 2004, at 7:02 PM, Marc Mutz wrote:
> Am I the only one who finds this enum definition curious?
>
> enum Communication {
> NoCommunication = 0,
> Stdin = 1, Stdout = 2, Stderr = 4,
> AllOutput = 6, All = 7,
> NoRead
> };
>
> This only works by pure luck, since All ensures NoRead = 8, keeping the
> bit flag nature of the enum intact. Maybe we should make the NoRead=8
> explicit? :)
>
> Marc
>
It would at least be consistent. If you have an enum you shouldn't be
relying on the "integer" value of the enumeration anywhere... just know
that
it has a unique enumeration.
There is nothing technically wrong with the code as it is. And if
people
are using integers where the Communication type is expected that's
bad practice.
Dave
> --
> Ich gegen meinen Bruder.
> Ich und mein Bruder gegen unseren Cousin.
> Ich, mein Bruder und unser Cousin gegen unsere Nachbarn.
> Wir alle gegen den Fremden.
> -- Beduinen-Sprichwort
More information about the kde-core-devel
mailing list