realloc((char *)NULL,size) - how standard ?
Kean Johnston
kean at pscnet.UUCP
Sat Feb 16 12:08:28 AEST 1991
The other day I had occasion to write a little C program which was repeatedly
increasing an array. Of course, realloc() is perfect for this. However, in
Harbison and Steele, they state that if you pass as the first parameter to
realloc a NULL pointer, then realloc() will allocate a block of size bytes
for you. No need to malloc the very first block.
Well, under Xenix 2.3.3 with 2.3.0 DevSys, this isn't so. If you don't do
the initial alloc() of the block, then realloc fails. Is using a NULL pointer
as the first parameter to realloc() a "standard" feature of the function, and
if so, which of the plethora of standards?
Thanks in advance,
Kean
--
+----------------------------------------------------------------------------+
| Kean Johnston: ..!ddsw1!proxima!olsa99!tabbs!pscnet!kean kean at pscnet.UUCP |
| "I think, therefore I AM" - Rene Descartes |
+----------------------------------------------------------------------------+
More information about the Comp.lang.c
mailing list