[ovs-dev] [PATCH ovn v7 5/6] Support logical switches with multiple localnet ports
Ihar Hrachyshka
ihrachys at redhat.com
Tue May 19 14:18:43 UTC 2020
On 5/19/20 10:05 AM, Ihar Hrachyshka wrote:
> My understanding is that we assume native C99 _Bool in our compiler
> (not a typedef / macro mapped onto int)
Oh I was too quick to assume that. As per coding-style.rst,
Also, don't assume that a conversion to ``bool`` or ``_Bool`` follows C99
semantics, i.e. use ``(bool) (some_value != 0)`` rather than
``(bool) some_value``. The latter might produce unexpected results on
non-C99
environments. For example, if ``bool`` is implemented as a typedef of
char
and ``some_value = 0x10000000``.
So we cannot rely on _Bool being a proper C99 boolean, and then your
suggestion becomes extremely important just from safety perspective!
Honestly, using booleans *without* C99 semantics is quite dangerous, so
I'm surprised they are used at all.
TIL. I will push v8 in an hour.
Ihar
More information about the dev
mailing list