IMO there's a bug in the use of sizeof in /arch/x86/boot/main.c, it's
also a strange style.
2008/12/13 Giangiacomo Mariotti <[email protected]>:
> IMO there's a bug in the use of sizeof in /arch/x86/boot/main.c, it's
> also a strange style.
>
Hi,
No this is not a bug, sizeof is a unary operator which can be used
with or without parenthesis :-)
Note: don't forget to put your Signed-off-by and some explanations
along your patches.
Also, not all maintainers accept patches as attachment.
On Sat, Dec 13, 2008 at 5:31 PM, Giangiacomo Mariotti
<[email protected]> wrote:
> IMO there's a bug in the use of sizeof in /arch/x86/boot/main.c, it's
> also a strange style.
>
It is not a bug. You don't need to use parenthesis when used on
variables. See 6.5.3.4.
On Sat, Dec 13, 2008 at 05:31:06PM +0100, Giangiacomo Mariotti wrote:
> IMO there's a bug in the use of sizeof in /arch/x86/boot/main.c, it's
> also a strange style.
> - BUILD_BUG_ON(sizeof boot_params != 4096);
> - memcpy(&boot_params.hdr, &hdr, sizeof hdr);
> + BUILD_BUG_ON(sizeof(boot_params) != 4096);
> + memcpy(&boot_params.hdr, &hdr, sizeof(hdr));
The 'sizeof xxx' style is perfectly valid.
Gregory
> IMO there's a bug in the use of sizeof in /arch/x86/boot/main.c, it's
> also a strange style.
Style is of course a matter of opinion, but sizeof is an operator, not a
function, and as far as I can see, there's no bug in how it is used even
without your patch.
- R.
On 12/13/08, Frédéric Weisbecker <[email protected]> wrote:> 2008/12/13 Giangiacomo Mariotti <[email protected]>:>> IMO there's a bug in the use of sizeof in /arch/x86/boot/main.c, it's>> also a strange style.>>>> Hi,>> No this is not a bug, sizeof is a unary operator which can be used> with or without parenthesis :-)>> Note: don't forget to put your Signed-off-by and some explanations> along your patches.> Also, not all maintainers accept patches as attachment.>You're right, I was wrong.????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m????????????I?