[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <m3r3p4qjjf.fsf@t19.piap.pl>
Date: Mon, 22 Jun 2015 09:39:00 +0200
From: khalasa@...p.pl (Krzysztof HaĆasa)
To: Joe Perches <joe@...ches.com>
Cc: Frans Klaver <fransklaver@...il.com>,
Andy Whitcroft <apw@...onical.com>,
lkml <linux-kernel@...r.kernel.org>
Subject: Re: Coding style details (checkpatch)
Joe Perches <joe@...ches.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/
Powered by blists - more mailing lists