2 ms·
A standards-conforming realloc will never try to allocate 0 bytes: it is required to free in that case.
by fanf2 11y ago
A standards-conforming realloc will never try to allocate 0 bytes: it is required to free in that case.
- cperciva 11y agoAlas, C11 seems to have bungled this.
- masklinn 11y agoThe change appeared in C99 apparently, in my ISO/IEC 9899:1999 PDF the part about a 0-sized realloc being equivalent to a free has already been removed, and that a 0-sized allocation can return either a NULL or a non-null pointer has appeared under implementation-defined behaviours (j.3.12)
- fanf2 11y agoYes. I had not previously noticed this. What a disaster.