lkml.org 
[lkml]   [2015]   [Jun]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Coding style details (checkpatch)
Date
Joe Perches <joe@perches.com> 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/

\
 
 \ /
  Last update: 2015-06-22 10:01    [W:0.080 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site