[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] [PATCH] Fix undefined behaviour of shifting left s
From: |
John Cowan |
Subject: |
Re: [Chicken-hackers] [PATCH] Fix undefined behaviour of shifting left signed values |
Date: |
Sun, 21 Jun 2015 17:11:51 -0400 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Peter Bex scripsit:
> - We are using left shifts on signed types. According to the C spec
> this behaviour is undefined (which is completely retarded, IMHO).
> The even more retarded fix is to simply cast to unsigned and back to
> signed whereever this is done.
Yeah, it reflects old processors.
> - We are dividing floating-point numbers by zero, which is apparently
> undefined.
Don't worry about that. Any C compiler that ignored IEEE 754 constraints,
even though C doesn't assume them, would be ostracized by numerical
programmers.
--
John Cowan http://www.ccil.org/~cowan address@hidden
And it was said that ever after, if any man looked in that Stone,
unless he had a great strength of will to turn it to other purpose,
he saw only two aged hands withering in flame. --"The Pyre of Denethor"