[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c29b5c97f97b48c894917647915bf510@AcuMS.aculab.com>
Date: Fri, 4 Jun 2021 08:13:57 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Alex Elder' <elder@...aro.org>,
'Manikishan Ghantasala' <manikishanghantasala@...il.com>,
Alex Elder <elder@...e.org>
CC: Alex Elder <elder@...nel.org>,
"greybus-dev@...ts.linaro.org" <greybus-dev@...ts.linaro.org>,
"linux-staging@...ts.linux.dev" <linux-staging@...ts.linux.dev>,
Johan Hovold <johan@...nel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [greybus-dev] [PATCH] staging: greybus: fixed the coding style,
labels should not be indented.
From: Alex Elder
> Sent: 03 June 2021 22:55
...
> Not necessarily, sizeof(bool) is implementation defined.
> And I thought you didn't think the size of the structure
> was very important...
It is 'implementation defined' but will be 32 bits on everything
except an old 32bit ARM ABI.
> In any case, I'm open to changing the type of these fields,
> and my preference would be bool rather than u8, because it
> is completely clear what it represents.
Yes, and it isn't at all clear what it actually means.
If the value of a bool memory location isn't 0 or 1
what does 'bool_a & bool_b' mean.
It might be 'undefined behaviour' - but that doesn't actually
exclude an ICBM hitting the coder's house!
I've seen very silly code generated (by an old gcc) for
simple statements like:
bool_a |= bool_b;
Mostly because it didn't trust the values to be 0 or 1
and wanted to ensure the result was either 0 or 1.
If I use an integer type (as in traditional C) I know
what I'm getting and there are no unexpected comparisons
and conditionals.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
Powered by blists - more mailing lists