Re: Determine which sum is larger
- From: Ben Bacarisse <ben.usenet@xxxxxxxxx>
- Date: Wed, 21 Nov 2007 02:07:47 +0000
Bart <bc@xxxxxxxxxx> writes:
On Nov 19, 8:38 am, Richard Heathfield <r...@xxxxxxxxxxxxxxx> wrote:
There isn't any overflow, of course, because unsigned types can't overflow.
Are you sure? That would be a very useful property.
Yes. Well I am, and I am pretty sure Richard Heathfield is sure too!
6.2.5 p9 says (in part):
... A computation involving unsigned operands can never overflow,
because a result that cannot be represented by the resulting
unsigned integer type is reduced modulo the number that is one
greater than the largest value that can be represented by the
resulting type.
Outside of the context of standard C, the term overflow is sometimes
used to refer to the warp-around that sometimes happens in both signed
and unsigned arithmetic but, when talking about C, it is better to
stick to the standard terminology.
--
Ben.
.
- Follow-Ups:
- Re: Determine which sum is larger
- From: CBFalconer
- Re: Determine which sum is larger
- From: Bart
- Re: Determine which sum is larger
- References:
- Determine which sum is larger
- From: Peter Ammon
- Re: Determine which sum is larger
- From: Richard Heathfield
- Re: Determine which sum is larger
- From: Bart
- Determine which sum is larger
- Prev by Date: Re: interesting C program
- Next by Date: Re: Where are the program variables stored in memory(text, data or stack segments)
- Previous by thread: Re: Determine which sum is larger
- Next by thread: Re: Determine which sum is larger
- Index(es):