Jan de Visser <j...@de-visser.net> writes: > On March 2, 2015 09:50:49 AM Tom Lane wrote: >> However, you could and should use pg_malloc0, which takes care of that >> for you...
> I am (using pg_malloc, that is). So, just to be sure: pg_malloc memsets the > block to 0, right? No, it doesn't, but pg_malloc0 does. Consult the code if you're confused: src/common/fe_memutils.c > My question was more along the lines if memsetting to 0 to ensure that > pointer > fields are NULL and int/long fields are 0. Yes, we do assume that widely, and so does a heck of a lot of other code. In principle the C standard doesn't require that a NULL pointer be all-zero-bits, only that casting "0" to a pointer yield a NULL pointer. But certainly there are no modern implementations that don't represent NULL as 0. Anybody who tried to do it differently would soon find that hardly any real-world C code would run on their platform. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers