[FFmpeg-devel] [RFC] Sechole in gcc 3.3+ and 4.*
Michael Niedermayer
michaelni
Mon Apr 7 16:40:17 CEST 2008
On Mon, Apr 07, 2008 at 03:25:04PM +0100, M?ns Rullg?rd wrote:
>
> 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.
Well if addition in Z is meant this should be written in the spec, its not
at all obvious as no physical system can perform arbitrary addition in Z.
There always is a pair of numbers which are too large.
What computers actually use is mathematically Z/nZ so its not unreasonable
to assume that this is meant in a specification related to arithmetic on
physical computers.
This is my interpretation of the spec, which may or may not be what the
authors intended.
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20080407/2c8d1af1/attachment.pgp>
More information about the ffmpeg-devel
mailing list