[PATCH xserver] squash! sync: Convert from "CARD64" to int64_t.
Pekka Paalanen
ppaalanen at gmail.com
Fri Aug 25 07:24:34 UTC 2017
On Thu, 24 Aug 2017 18:21:15 -0700
"Keith Packard" <keithp at keithp.com> wrote:
> Michel Dänzer <michel at daenzer.net> writes:
>
> > Is assigning an unsigned value with the MSB set to a signed variable
> > well-defined in C?
>
> I have no idea. And I just spent a few hours wading through the N1570
> draft of the C standard on a related issue. In particular, this is
> worrying:
>
> 6.3.1.3
>
> 3 Otherwise, the new type is signed and the value cannot be represented
> in it; either the result is implementation-defined or an
> implementation-defined signal is raised.
>
> I don't think the absence of a cast matters.
>
> Surely some better language lawyer can tell us the answer...
Hi,
why not just do what Alexander suggested and write the overflow tests
such that they do not rely on uncertain behaviour?
E.g.
https://stackoverflow.com/questions/2633661/how-to-check-integer-overflow-in-c/2633929#2633929
No possibility for overflows, no sketchy casts.
Thanks,
pq
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.x.org/archives/xorg-devel/attachments/20170825/d97c24f1/attachment.sig>
More information about the xorg-devel
mailing list