✘ Bad Patch: nteger handling issues (SIGN_EXTENSION).

Eric S. Raymond esr at thyrsus.com
Thu May 11 20:56:17 UTC 2017


Gary E. Miller via devel <devel at ntpsec.org>:
> get_lsb_ulong() takes an unsigned and returns and unsigned.
> 
> So it makes sense just to keep everything unsigned, but gcc thinks
> this is all insigned:
> 	retval |= *((*bufppa)++);
> 
> But that there is an implicit conversion to int here:
> 
>        retval |= *((*bufpp)++) << 8;
> 
> Why does the "<< 8" affect the implicit sign?

I don't know.  It certainly seems like the signedness of the expression
result ought to be the signedness of the left operand.  You might
consider digging into C99 standard to see if this is specified.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

Please consider contributing to my Patreon page at https://www.patreon.com/esr
so I can keep the invisible wheels of the Internet turning. Give generously -
the civilization you save might be your own.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 811 bytes
Desc: not available
URL: <https://lists.ntpsec.org/pipermail/devel/attachments/20170511/ebc2177c/attachment.bin>


More information about the devel mailing list