Andreas Rheinhardt (12021-03-01): > 3. As you probably guessed from the last part of 2., I don't think that > casting avoids the possibility of undefined behaviour* (because this > conversion is done automatically anyway); but it might very well protect > the code from aggressively optimizing compilers.
Possibly not. On the other hand, there is no doubt that (type *)((char *)structp + offsetof(field)) would be valid, since: - (char *)structp + offsetof(field) is really a pointer on field, so it has proper alignment for type; - the entire array is within a memory block obtained through malloc(). So, worst case scenario, we can use this construct to work around a compiler that does stupid optimizations. Regards, -- Nicolas George
signature.asc
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".