Warning report for wine-1.3.30-55-g583e887
josh at iswifter.net
Wed Oct 12 15:53:48 CDT 2011
On Oct 12, 2011, at 1:31 PM, Octavian Voicu wrote:
> On Wed, Oct 12, 2011 at 11:22 PM, Josh Juran <josh at iswifter.net> wrote:
>> My understanding is that accessing element n or greater in an array[n]
>> is undefined behavior, but declaring a huge array and allocating only
>> part of it is valid.
> It's a commonly used pattern in C.
> You declare a size-one array at the
> end of a structure, then you allocate enough memory to hold the
> structure plus (n-1) extra elements of the array. In wine size is
> usually calculated with the macro FIELD_OFFSET(struct, member[size]).
I understand. I'm just passing on what I read on another mailing list, which is that the construction is non-portable (even if it happens to work everywhere), and that might be the justification for the warning. A purist approach would call for avoiding this idiom, but pragmatically, disabling the warning is sufficient.
More information about the wine-devel