[PATCH] malloc: Cleanup warnings

Paul Eggert eggert@cs.ucla.edu
Wed Mar 11 21:53:31 GMT 2026


On 2026-03-11 10:30, Wilco Dijkstra wrote:
> -      size_t csize;
> +      size_t csize = 0;
I'm not a fan of useless initializations like this. It's not about the 
inefficiency here, as GCC with -O2 should optimize this one away. It's 
that it confuses the human reader into thinking that the initialization 
is needed.

In Emacs we attack this sort of problem by using this instead:

     size_t csize UNINIT;

where UNINIT is defined something like this:

   #ifdef GCC_LINT
   # define UNINIT = {0,}
   #else
   # define UNINIT /* empty */
   #endif

I suggest doing something similar in glibc. That way, the code will 
become clearer than simply slapping in useless initializations, and we 
won't need those annoying DIAG_* macros. Glibc builders can define 
GCC_LINT according to their preferences, and glibc can supply a 
reasonable default for GCC_LINT.


More information about the Libc-alpha mailing list