[tz] [PATCH] Fix warnings if !ALL_STATE: address of gmtmem always, evaluates as true

Paul Eggert eggert at cs.ucla.edu
Tue Feb 28 23:19:52 UTC 2017

On 02/28/2017 11:34 AM, Andreas Stieger wrote:
> would you not say that less warnings would make the real ones stand 
> out better? 

Sure, but using appropriate compiler options should also generate less 
warnings, and that should be a better solution.

The idea is to avoid contorting C code merely to pacify a compiler 
that's configured to be too picky. The proposed code:

  #ifdef ALL_STATE
      gmtptr = malloc(sizeof *gmtptr);
      if (gmtptr)

is hard to read, since the C preprocessor nesting is not consistent with 
the preprocessed nesting. Readability is more important than silencing 
false positives.

More information about the tz mailing list