On Wed, Oct 12, 2011 at 11:22 PM, Josh Juran <j...@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]).

Octavian


Reply via email to