[PATCH 1/3] include: Define FIELD_OFFSET to the standard offsetof macro
mstefani at redhat.com
Tue Dec 11 03:52:50 CST 2012
On 12/11/2012 10:20 AM, Dmitry Timoshkov wrote:
> Michael Stefaniuc <mstefani at redhat.com> wrote:
>> On 12/10/2012 07:37 PM, Amine Khaldi wrote:
>>> This prevents the undefined behavior (null pointer dereference)
>>> diagnostics (clang with ubsan checks for example).
>> This is a bug in clang. There is no null pointer dereference.
>> Afair gcc tried to pull this trick too but got educated about their error.
> What's an advantage of these patches except of catering broken compilers/
I figure you mean the 2nd try which uses offsetof unconditionally.
The advantage is that it replaces the cast orgy with the C89 standard
construct thus it easier to read. Appeasing the still wrong clang check
is just a side effect.
More information about the wine-devel