BUG: realloc(p,0) is not conforming to C99/C11/C17/POSIX.1-2008

Siddhesh Poyarekar siddhesh@gotplt.org
Fri Oct 18 01:26:50 GMT 2024


On 2024-10-17 21:11, Siddhesh Poyarekar wrote:
> to assume that applications rely on it than not.  If there is consensus 
> to change this behaviour, it needs at least the following:

FAOD, I haven't voiced an opinion for or against this change.  If 
anything, it may be best to have the compiler warn users (maybe through 
a new -Wanalyzer option or if a more comprehensive, runtime option is 
desired, add a tunable that turns this on) whenever a realloc(p, 0) is 
encountered and suggest that they unambiguously free+malloc or free, 
depending on what they actually intend.

Sid


More information about the Libc-alpha mailing list