qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Use standard header for offsetof


From: Stefan Weil
Subject: Re: [Qemu-devel] [PATCH] Use standard header for offsetof
Date: Tue, 03 Jun 2008 23:03:15 +0200
User-agent: Mozilla-Thunderbird 2.0.0.14 (X11/20080509)

Anthony Liguori schrieb:

I don't understand why you're adding #include <stdef.h> to files that do not define offsetof. What's the rationale for that?

Regards,

Anthony Liguori

There were several possible ways to replace the defines for offsetof.
After removing the defines, I could

1) include stddef.h at the places where offsetof was defined formerly

or

2) include stddef.h at the places where offsetof was used

or

3) include stddef.h for all files where the compiler complains because of missing declaration for offsetof

I prefered solution 2 because it minimizes dependencies and usage of include files. Solution 3 would have needed a complete compile test (all possible targets for all
possible hosts and all possible configuration options).

Normally, I also add a comment behind any include statement which shows the reason for it:

#include <stddef.h>   /* offsetof */

So everybody can see why the include is there, and the maintainer can remove it
when the former reason is no longer valid.
But this is not Qemu-like style, so I did not use it here.

Regards,
Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]