NULL need not be all bits 0

D. Hugh Redelmeier hugh@mimosa.com
Mon, 25 Oct 1999 11:38:19 -0400 (EDT)


This is portability nitpicking.

It is a little known fact that the representation of a NULL of a
particular pointer type may not have all bits 0.  So clearing a chunk
of memory to zero is not guaranteed to initialize any pointer objects
in that memory to NULL.

gnupg-1.0.0/mpi/mpi-mpow.c" line 90:
    G = m_alloc_clear( (1<<k) * sizeof *G );

The code assumes that this initializes an array of MPI pointers to
NULL.  This works on almost all machines, but is not guaranteed to
work by the C standard.

Hugh Redelmeier
hugh@mimosa.com  voice: +1 416 482-8253