[FFmpeg-devel] [PATCH 3/7] Add alias-safe union typedefs

Måns Rullgård mans
Mon Feb 1 01:45:37 CET 2010

Alexander Strange <astrange at ithinksw.com> writes:

> On Jan 31, 2010, at 7:13 PM, M?ns Rullg?rd wrote:
>> Uoti Urpala <uoti.urpala at pp1.inet.fi> writes:
>>>> Casts with may_alias were found to work for x264, but the portable
>>>> solution is probably either no strict aliasing or using memcpy().
>>> Why would no strict aliasing be more portable than may_alias?
>> I think he meant writing the code without any aliasing violations in
>> the first place.  Unfortunately that is not an option until compilers
>> get a clue, and my thermometer in hell is still indicating hot.
> I meant turning off the type-based aliasing optimizations in the
> compiler, if you're trying to build with some non-GNU C compiler
> that you don't know the may_alias equivalent for.
> Although that's something the user has to do themselves, so it's not
> really a solution here.

If we discover one we can/should/will detect it and handle it
automatically.  This isn't much different from how we handle
declarations of data with extra alignment.

M?ns Rullg?rd
mans at mansr.com

More information about the ffmpeg-devel mailing list