Thus spake Bruce Evans <[EMAIL PROTECTED]>: > On Sat, 23 Nov 2002, David Schultz wrote: > > > Thus spake Bruce Evans <[EMAIL PROTECTED]>: > > > ... C90 has a bogus requirement that > > > the pointer for malloc(0) be "unique", whatever that means. C99 only > > > requires that the objects pointed to by the results of malloc() be > > > disjoint, and this is satisfied by FreeBSD's behaviour of returning the > > > same magic pointer for each instance of malloc(0). > > > > In FreeBSD, malloc(0) returns a distinct pointer each time by > > making a 16-byte allocation. I seem to recall that it may have > > returned a single magic pointer at one time, so what you say might > > have been correct some time ago. > > Actually, it is correct now. malloc(0) returns the constant invalid > pointer ZEROSIZEPTR (0x800 on i386's), but it returned a distinct pointer > before the ZEROSIZEPTR stuff was added in rev.1.60 of libc/stdlib/malloc.c. > (All this is without the malloc option V which causes malloc(0) to return > a null pointer.)
Aah, what I ``seemed to recall'' is actually the behavior in -CURRENT, and what I described applies to 3.X and 4.X. Thanks for the clarification. To Unsubscribe: send mail to [EMAIL PROTECTED] with "unsubscribe freebsd-current" in the body of the message