[ovs-dev] [PATCH] lib/flow.h: Improve struct miniflow comment and definition.
Ben Pfaff
blp at nicira.com
Tue Aug 26 23:08:36 UTC 2014
On Tue, Aug 26, 2014 at 04:04:09PM -0700, Jarno Rajahalme wrote:
>
> On Aug 26, 2014, at 3:53 PM, Ben Pfaff <blp at nicira.com> wrote:
>
> > On Tue, Aug 26, 2014 at 03:42:33PM -0700, Jarno Rajahalme wrote:
> >> Finally, use change the storage type of 'values_inline' to uint8_t, as
> >> uint64_t looks kind of wide for a boolean, even though we intend the
> >> bit be carved out from the uint64_t where 'map' resides.
> >
> > It can't be type "bool"?
>
> From CodingStyle:
>
> Declare bit-fields to be type "unsigned int" or "signed int". Do
> *not* declare bit-fields of type "int": C89 allows these to be either
> signed or unsigned according to the compiler's whim. (A 1-bit
> bit-field of type "int" may have a range of -1...0!) Do not declare
> bit-fields of type _Bool or enum or any other type, because these are
> not portable.
>
> :-)
This was important when we supported C89 compilers that did not have
native _Bool (bool), but I think that it is obsolete now, because all
of the compilers we support have C99 implementations good enough to
have native _Bool.
Let's find out and update CodingStyle if so.
Guru: does MSVC allow "bool" bit-fields? I assume so but it's worth a
test.
Thanks,
Ben.
More information about the dev
mailing list