lfpinit() signed or unsigned?

Hal Murray hmurray at megapathdsl.net
Fri Mar 10 04:02:46 UTC 2017


esr at thyrsus.com said:
>> Do any of the casts actually change any bits?
> I believe not. 

Then all the casts are just noise to keep the compiler happy and/or hints to 
tell the reader what the intent is.

> I believe the RFC intention is that they should be unsigned offsets from an
> epoch date, and the signed case only arises as a result of interval
> calculations internal to ntpd. 

That makes sense.  Unsigned on the wire.  Signed internally for deltas.

>> What I was trying to suggest is that another layer of macros might
>> eliminate a batch of casts.
> Well, maybe. I didn't find a way to do that.  It's possible I wasn't clever
> enough. 

How about something like l_fp_time (unsigned) and l_fp_delta or l_fp_offset 
(signed)?

The casts I was thinking of eliminating were in the main code -- push them 
into macros if needed.


-- 
These are my opinions.  I hate spam.





More information about the devel mailing list