2 ms·
C libraries do not conform to the standard if they do not free in this case.
by fanf2 11y ago
C libraries do not conform to the standard if they do not free in this case.
- masklinn 11y agoThat requirement was present in C89 and removed in C99, which also added that a 0-sized allocation doesn't have to return a null pointer (whether done by malloc, calloc or realloc)
- kazinator 11y agoDang, is that right? See, I checked C99 when I posted the comment. I don't know where my old copy of C90 is, but I was mildly surprised. I had that WTF feeling "I could have sworn it was supposed to work that way! In any case, if I'm compiling with -ansi or -std=c90 on a GCC-based platform that is hosted, the library had better behave in the C90 conforming manner. Only if if -std=c99 is used should it take the liberty with realloc(ptr, 0) being like malloc(0).
- jheriko 11y agoC libraries do not conform to the standard.