[FFmpeg-devel] [RFC] Sechole in gcc 3.3+ and 4.*
Måns Rullgård
mans
Mon Apr 7 16:25:04 CEST 2008
Michael Niedermayer wrote:
> On Mon, Apr 07, 2008 at 03:38:31PM +0300, Uoti Urpala wrote:
> [...]
>> ---
>> Part 6.5 Expressions:
>> If an exceptional condition occurs during the evaluation of an
>> expression (that is, if the result is not mathematically defined or not
>> in the range of representable values for its type), the behavior is
>> undefined.
>> ---
>>
>> If the sum of signed variables overflows the above applies. The unsigned
>> behavior of always reducing mod size (which means the result is always
>> representable) is described elsewhere.
>
> Twos complement addition, subtraction and multiplication are identical to
> their unsigned counterparts. That is they form in isomorphism relative to
> them.
> They are mathematically well defined as +,* in Z/nZ with n=2^bits. And their
> values are representable, after all the identical opertation called unsigend
> has them representable.
You're mixing concepts here. The + operator is defined in terms of
mathematical addition of the regular kind, no modulus arithmetic. The
paragraph quoted above clearly states that values outside the range of
the type invoke undefined behaviour. I don't see how it could be much
clearer.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list