Skip site navigation (1) Skip section navigation (2)

Re: arrayfuncs: fix read of uninitialized mem

From: Neil Conway <neilc(at)samurai(dot)com>
To: Joe Conway <mail(at)joeconway(dot)com>
Cc: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: arrayfuncs: fix read of uninitialized mem
Date: 2004-09-15 23:11:14
Message-ID: 1095289855.31400.2.camel@localhost.localdomain (view raw or flat)
Thread:
Lists: pgsql-patches
On Thu, 2004-09-16 at 03:32, Joe Conway wrote:
> Personally I prefer the original style here.

Personally I like the style I used, because it makes one class of
mistake more difficult -- getting the sizeof() wrong. Suppose the type
of the variable you're allocating changes -- if you use

ptr = malloc(sizeof(*ptr));

then the code is still right, but with

ptr = malloc(sizeof(some_type));

you need to remember to update the sizeof(); worse, the compiler won't
warn you about this.

-Neil



In response to

Responses

pgsql-patches by date

Next:From: Neil ConwayDate: 2004-09-15 23:18:17
Subject: Re: arrayfuncs: fix read of uninitialized mem
Previous:From: Peter EisentrautDate: 2004-09-15 23:07:34
Subject: Re: x86_64 configure problem

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group