From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K3df7-0003FT-0H for qemu-devel@nongnu.org; Tue, 03 Jun 2008 17:03:21 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K3df5-0003FG-M1 for qemu-devel@nongnu.org; Tue, 03 Jun 2008 17:03:20 -0400 Received: from [199.232.76.173] (port=41785 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K3df5-0003FD-GS for qemu-devel@nongnu.org; Tue, 03 Jun 2008 17:03:19 -0400 Received: from moutng.kundenserver.de ([212.227.126.177]:53386) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K3df4-0005ZH-Rs for qemu-devel@nongnu.org; Tue, 03 Jun 2008 17:03:19 -0400 Message-ID: <4845B193.8030209@mail.berlios.de> Date: Tue, 03 Jun 2008 23:03:15 +0200 From: Stefan Weil MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] Use standard header for offsetof References: <4842DE67.9090207@mail.berlios.de> <484596C2.8030908@codemonkey.ws> In-Reply-To: <484596C2.8030908@codemonkey.ws> Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Anthony Liguori schrieb: > > I don't understand why you're adding #include 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 /* 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