ozbear
10/14/2003 9:56:00 AM
On Mon, 13 Oct 2003 18:18:39 +0200, "Mr.Tickle" <MrTickle@mrmen.com>
wrote:
>Simple. Enums are currently automatic, except they are AUTOMATIC INCORRECTLY
>when FLAGS attribute is set.
>
>Its INCORRECT behaviour for the Flags attribute. Since when is a bitfield
>automaticly set to 1, 2, 3, 4, 5`?? Thats what it does.
>
>What I am asking is if we can have it automatically set to 1, 2, 4, 8, 16...
>CORRECTLY.
>
>
>
>"Stoyan Damov" <stoyand@code.bg> wrote in message
>news:e8eC#pZkDHA.2268@TK2MSFTNGP12.phx.gbl...
>> I couldn't understand anything. Sorry if I have offended you in any way.
>>
>> Cheers,
>> Stoyan
>>
>> "Mr.Tickle" <MrTickle@mrmen.com> wrote in message
>> news:ubWKWnZkDHA.424@TK2MSFTNGP10.phx.gbl...
>> > Well, we have already automatic support for enums, its overridable, so
>why
>> > not have it consistant to that of non Flag enums?
>> >
>> > If we are lazy? Enums currently (for non bitmasks) are already defined.
>> > Youre lazy argument falls flat on its face.
>> >
>> >
>> >
>> > "Stoyan Damov" <stoyand@code.bg> wrote in message
>> > news:eN1tbaXkDHA.2364@TK2MSFTNGP11.phx.gbl...
>> > > To me, the automatic compiler support is asking for errors. If you
>> reorder
>> > > your enum, you break their values, e.g. an enum saved to a file
>(before
>> > the
>> > > reordering), won't be read properly (after the reordering). If you are
>> too
>> > > lazy to set bit masks, you can always define enums in this way:
>> > >
>> > > [Flags]
>> > > public enum Whatever
>> > > {
>> > > None = 0,
>> > > Flag1 = 1,
>> > > Flag2 = Flag1 << 1,
>> > > Flag3 = Flag2 << 1,
>> > > // etc.
>> > > CheckMask = Flag1 | ... | FlagN
>> > > }
>> > >
>> > > Cheers,
>> > > Stoyan
>> > >
>> > > "Mr.Tickle" <MrTickle@mrmen.com> wrote in message
>> > > news:%23Rx7p79jDHA.3312@tk2msftngp13.phx.gbl...
>> > > > When setting the [Flags] attribute on an enum, why should I have to
>> > > specify
>> > > > powers of 2 when the compiler should see this is a bitfield and set
>> the
>> > > > range accordingly, why should I have to do the work that the
>compiler
>> > can
>> > > > do?
>> > > >
>> > > >
>> > > > To me this is just asking for errors to be introduced by offloading
>> this
>> > > > responsibility onto the programmer.
>> > > >
>> > > > Sure we should be able to override a value in the bitfield enum to
>> allow
>> > > > ranges like All = Enum1Val | Enum2Val; etc.
>> > > >
>> > > >
>> > > >
>> > >
>> > >
>> >
>> >
>>
>>
>
>
Idiot