[FFmpeg-devel] [PATCH] AAC: type puns for 16 bit floating point rounding

Måns Rullgård mans
Fri Dec 5 10:42:17 CET 2008


Dave Dodge <dododge at dododge.net> writes:

> On Fri, Dec 05, 2008 at 12:16:44AM +0000, M?ns Rullg?rd wrote:
>> The effects of violating the aliasing rules are *undefined*.
>> Implementations are not required to document their behaviour, nor need
>> the behaviour be consistent.
>
> Just FYI, type punning through a union appears to be a documented and
> supported operation in C99 TC3 (published in November 2007).  And
> since the documentation is in an explanatory footnote rather than a
> change to the normative text, it suggests that it was required to work
> as of TC2 or even before.  From TC3:
>
>     15. Page 073, 6.5.2.3
>     Attach a new footnote to the words "named member" in paragraph 3:
>
>     'If the member used to access the contents of a union object is
>     not the same as the member last used to store a value in the
>     object, the appropriate part of the object representation of the
>     value is reinterpreted as an object representation in the new type
>     as described in 6.2.6 (a process sometimes called "type punning").
>     This might be a trap representation.'
>
> If the member that was stored does not completely overlap the member
> being fetched, the extra bytes have unspecified values.  That comes as
> a result of some normative changes in TC2.

Thank you very much for that reference.  That is all I needed.

-- 
M?ns Rullg?rd
mans at mansr.com




More information about the ffmpeg-devel mailing list