lfpinit() signed or unsigned?

Gary E. Miller gem at rellim.com
Thu Mar 9 20:54:02 UTC 2017


Yo Eric!

On Thu, 9 Mar 2017 15:42:20 -0500
"Eric S. Raymond" <esr at thyrsus.com> wrote:

> Hal Murray <hmurray at megapathdsl.net>:
> > 
> > esr at thyrsus.com said:  
> > > It doesn't matter.  All those calculations are casted to within
> > > an inch of their lives. :-)   
> > 
> > Would it help to have another signed type?  
> 
> The short answer is "no".  The longer answer:

I'm starting to disagree, I see a need for only a signed type.

Too often the unsigned type is then used to compute offsets and the
casts get ugly.

> If I were willing to commit either way I could
> throw away several of them in favor of bare arithmetic operations.

Which I find another good reason to do this.  The wrong macros are used
a lot of the time.  Simplification will make it harder to repeat the
mistakes of the past.

> I've chosen not to do that because the reality is that the code
> sometimes wants to treat the abstract type as signed and sometimes as
> unsigned.

I see no case, yet, where the unsigned does not fit in a signed.  And
since we are throwing casts on casts on casts in macros if there was
a problem it would be batich to see.

As I am untgling I only see things looking better.

> That is a prospect that makes me even more nervous than the dodgy
> casts and type punning we're using now.

I see it the reverse, get rid of all the casting about, and make things
more explicit.

> If we changed all those usage sites I think the proof problem would
> become a lot more difficult.  That's why, as nervous as the present
> code makes me, I haven't tried to abolish the abstract data type it
> implements.

All of this will have to be one big patch, as things have to
change atomically.  I'll not make it a merge request as this is
something that buildbot will be essential for.

And since it is one patch, you can revert it if need be.

If you want, I can post a git diff for review first.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
	gem at rellim.com  Tel:+1 541 382 8588

	    Veritas liberabit vos. -- Quid est veritas?
    "If you can’t measure it, you can’t improve it." - Lord Kelvin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ntpsec.org/pipermail/devel/attachments/20170309/a7b3d323/attachment.bin>


More information about the devel mailing list