Re: Coding style details (checkpatch)

From: Krzysztof HaÅasa
Date: Mon Jun 22 2015 - 03:39:09 EST


Joe Perches <joe@xxxxxxxxxxx> writes:

> #define VDREG8(a0) ((const u16[]){ \
> a0 + 0x000, a0 + 0x010, a0 +0x020, a0 + 0x030, \
> a0 + 0x100, a0 + 0x110, a0 +0x120, a0 + 0x130})
>
> as "const u16[]" is a $Type but "const u16[<digits>]" is not.
>
> Still, as written, the code seems fragile as MACRO[index]
> allows index to be any value, maybe larger than the array.

Right.
XXX[8] is meant as an additional mental check. Not very effective,
though I think certain GCCs can issue a warning for obvious
out-of-bounds accesses (probably with both [] and [8]).
--
Krzysztof Halasa

Industrial Research Institute for Automation and Measurements PIAP
Al. Jerozolimskie 202, 02-486 Warsaw, Poland
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at http://www.tux.org/lkml/