Calculating offsets involving a NULL pointer is undefined. It works in
practice (for now?), but we should not rely on it. Allocate first and
then simply refer to the flexible array member by its name instead of
performing pointer arithmetic up front. The resulting code is slightly
shorter, easie
On Sat, Oct 15, 2016 at 06:23:11PM +0200, René Scharfe wrote:
> Calculating offsets involving a NULL pointer is undefined. It works in
> practice (for now?), but we should not rely on it. Allocate first and
> then simply refer to the flexible array member by its name instead of
> performing poin
Am 15.10.2016 um 19:13 schrieb Jeff King:
> On Sat, Oct 15, 2016 at 06:23:11PM +0200, René Scharfe wrote:
>
>> Calculating offsets involving a NULL pointer is undefined. It works in
>> practice (for now?), but we should not rely on it. Allocate first and
>> then simply refer to the flexible arra
On Sun, Oct 16, 2016 at 12:06:02PM +0200, René Scharfe wrote:
> > Yeah, this NULL computation is pretty nasty. I recall trying to get rid
> > of it, but I think it is impossible to do so portably while still using
> > the generic xalloc_flex() helper.
>
> The only way I see is to pass the type to
4 matches
Mail list logo