M
Method Man
Ben Pfaff said:Dereferencing the result of malloc(0) yields undefined behavior.
How can you say for certain that it will yield UB? Assuming the pointer
obtained from malloc(0) is unique and valid, it therefore must be pointing
to some valid memory location. I thought only invalid and void pointers
caused UB when dereferenced. Perhaps I am misunderstanding something.
What problem do you envision with type-casting it?
I was brainstorming. I suppose there wouldn't be any problems.