realloc

Jerry Schwarz jss at hector.UUCP
Sat Apr 8 00:33:42 AEST 1989


In article <3240 at goofy.megatest.UUCP> djones at megatest.UUCP (Dave Jones) writes:
>
>This discussion is about the proposed ANSI behavior of malloc(0): namely
>returning (char*)0.
>

Its really about a rumor about the standard.  The actual proposed
standard says (4.10.3)

        "If the size of the space requested is zero, the behavior is
        implementation-defined; the value returned shall be either a
        null pointer or a unique pointer."

In other words the status of malloc(0) is exactly the same as it is
now.  In some implementations it will return a null pointer and in
others it won't.  A program that assumes either behavior may be
conforming but not strictly conforming (i.e. not maximally portable).


Jerry Schwarz
AT&T Bell Labs, Murray Hill



More information about the Comp.std.c mailing list