Dear SDCC users,
do any of you use realloc(p, 0) for non-null p?
Historically, C implementations diverged substantially here, and what
ANSI C89 / ISO C90 mandates¹ is different from what ISO C99 mandates² (I
don't to go to explaining POSIX here). In current C23 it is undefined
behavior.
I'd like to change the behavior of SDCC realloc from the C90 to the C99
one. Would that be a problem for you?
Philipp
¹ In ISO C90, realloc(p, 0) for non-null p is equivalent to free(p) and
returning null.
² In C90 it will either not free, and return null or return a non-null
pointer like it would for non-zero size.
P.S.: If you want to know more background, see
https://www.open-std.org/jtc1/sc22/wg14/www/docs/summary.htm#dr_400
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3621.txt
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2464.pdf
https://www.open-std.org/jtc1/sc22/wg14/www/docs/n2438.htm
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user