top | item 44389646

(no title)

jmgao | 8 months ago

C89: https://port70.net/%7Ensz/c/c89/c89-draft.html

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.

discuss

order

f1shy|8 months ago

Isn’t -1 basically 0xffff which is a constant pointer? What am I missinterpreting?

comex|8 months ago

If you call malloc(0) multiple times (without freeing in between) and get -1 each time, then the pointer is not unique.