<div dir="ltr"><div dir="ltr">> C's refusal to specify dynamic memory allocation in the language runtime<br>> (as opposed to, eventually, the standard library) </div><div dir="ltr"><br></div><div>This complaint overlooks one tenet of C: every operation in what you</div><div>call "language runtime" takes O(1) time. Dynamic memory allocation</div><div>is not such an operation.</div><div><br></div><div>Your hobbyhorse awakened one of mine.</div><div dir="ltr"><br></div><div>malloc was in v7, before the C standard was written. The standard </div><div>spinelessly buckled to allow malloc(0) to return 0, as some </div><div>implementations gratuitously did. I can't imagine that any program</div><div>ever actually wanted the feature. Now it's one more undefined</div><div>behavior that lurks in thousands of programs.</div><div><br></div><div>There are two arguments for malloc(0), Most importantly, it caters for</div><div>a limiting case for aggregates generated at runtime--an instance of</div><div>Kernighan's Law, "Do nothing gracefully". It also provides a way to </div><div>create a distinctive pointer to impart some meta-information, e.g.</div><div>"TBD" or "end of subgroup", distinct from the null pointer, which</div><div>merely denotes absence.</div><div><br></div><div>Doug</div></div>