realloc

Henry Spencer henry at utzoo.uucp
Thu Mar 30 06:54:33 AEST 1989


In article <10170 at bloom-beacon.MIT.EDU> scs at adam.pika.mit.edu (Steve Summit) writes:
>... It is an apparently well-
>kept secret that realloc is supposed to behave gracefully at
>a slightly special-cased boundary point: when handed a NULL
>pointer and a nonzero size, it acts essentially as a malloc.

Unfortunately, this is (at present) not a portable assumption, because
neither V6 nor V7 Unix -- the Unixes from which essentially all others
are descended, and which included the first widely-known C compilers -- 
did this.  It was invented later.  There are probably a fair number
of old systems that haven't caught up with it.  (It *is* in ANSI C as
of the Oct. draft, so it will *eventually* be a portable assumption.)
-- 
Welcome to Mars!  Your         |     Henry Spencer at U of Toronto Zoology
passport and visa, comrade?    | uunet!attcan!utzoo!henry henry at zoo.toronto.edu



More information about the Comp.std.c mailing list