Re: [PATCH 09/12] enum: only warn (once) when mixing bitwiseness

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

 



On Fri, Sep 7, 2018 at 6:06 PM Luc Van Oostenryck
<luc.vanoostenryck@xxxxxxxxx> wrote:
>
> but currently your example can only be handled if the base type is selected
> in two passes. Is it worth?

Maybe it doesn't matter.

My personal expectation was actually that the base type of the values
would *always* be the "enum" itself, and then you'd just select the
type for the enum based on the values.

Then there wouldn't be any difference between bitwise and non-bitwise
enums for the individual values. If you have

    enum a {
        one = 1,
        two = 2,
    };

then "one" and 'two" are always of type "enum a". The only difference
with a bitwise enum and one that isn't would be that a non-bitwise
enum just then evaluates to "int" (or whatever the size is, based on
the value range) much more easily.

Your approach (and what we used to do) is to get rid of the "enum a"
earlier, so that "one" is always just of type 'int". Or did I
mis-understand?

Our enum handling has always been kind of half-arsed.

             Linus



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux