qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Weil <weil@mail.berlios.de>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] Use standard header for offsetof
Date: Tue, 03 Jun 2008 23:03:15 +0200	[thread overview]
Message-ID: <4845B193.8030209@mail.berlios.de> (raw)
In-Reply-To: <484596C2.8030908@codemonkey.ws>

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	other threads:[~2008-06-03 21:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-01 17:37 [Qemu-devel] [PATCH] Use standard header for offsetof Stefan Weil
2008-06-02  6:21 ` Johannes Schindelin
2008-06-03 19:08 ` Anthony Liguori
2008-06-03 21:03   ` Stefan Weil [this message]
2008-06-03 21:24     ` Anthony Liguori
2008-06-06 19:44       ` Stefan Weil
2008-06-06 19:58         ` Andreas Färber
2008-06-09 10:30           ` Ian Jackson
2008-06-06 20:32         ` Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4845B193.8030209@mail.berlios.de \
    --to=weil@mail.berlios.de \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).