[[PATCH RFC 2] 02/63] Y2038: add function __difftime64

Paul Eggert eggert@cs.ucla.edu
Tue May 22 21:15:00 GMT 2018


On 05/22/2018 01:58 PM, Albert ARIBAUD wrote:
> But here we're talking about optimizing*away*  code which the
> compiler finds it won't use at all any more.

That's fine. GCC does this sort of thing all the time. It is a normal 
thing to write portable code that contains portions executed only on 
some platforms.

The proposed hand-optimization does not improve efficiency at all, so 
there is no good reason to insist on doing it by hand. Maintaining two 
copies of the source code would cause more maintenance work in the long 
run, and would increase the probability of bugs like the bug we already 
found in the "optimized" version. Although whether one should do an 
optimization is often a judgment call that could go either way, this 
particular case is a slam-dunk: we should let GCC do the optimization, 
and we should keep the overall source code simpler rather than maintain 
two copies of it, one "optimized" (but no faster).

As I recall, there were other unnecessary duplications in the proposed 
set of patches, so this is not just an issue of difftime.



More information about the Libc-alpha mailing list