Re: bitwise enums

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

 



On Tue, Feb 20, 2018 at 4:06 PM, Luc Van Oostenryck
<luc.vanoostenryck@xxxxxxxxx> wrote:
>
> I'm not 100% sure I understand the problem (if problem there is).
> For the typedef, yes it's how it's used for __le32 or gfp_t because
> we want to combine __bitwise with int to create a new, distinct type.
> But here, we don't care about the typedef because we don't need one
> since we're creating a new, distinct type anyway: the enum itself.

Yes, but think of it this way.. Imagine that you do:

        typedef enum __bitwise foobar { FOO, BAR, } my_t;

and now those constant FOO and BAR are a bitwise enum, and compatible
with "my_t". That's what we're aiming for, right?

What happens if we then do

        typedef enum __bitwaise foobar another_t;

which is *another* type of the same base type?

I personally think that the _constants_ (FOO and BAR) should be
compatible with _both_ types, but a variable of type "my_t" should not
mix with a variable of type "another_t".

I dunno. Maybe this is not worth worrying about.

             Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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