From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11446 invoked by alias); 8 Nov 2012 05:04:55 -0000 Received: (qmail 11432 invoked by uid 22791); 8 Nov 2012 05:04:54 -0000 X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_NO X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 08 Nov 2012 05:04:49 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 96CF02E0CB; Thu, 8 Nov 2012 00:04:48 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id kh0Q4JjH45ZT; Thu, 8 Nov 2012 00:04:48 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 501EB2E0C7; Thu, 8 Nov 2012 00:04:48 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id 7C202C67E7; Wed, 7 Nov 2012 21:04:39 -0800 (PST) Date: Thu, 08 Nov 2012 05:04:00 -0000 From: Joel Brobecker To: Yao Qi Cc: Pedro Alves , gdb-patches@sourceware.org Subject: Re: [PATCH] Always include defs.h first. Message-ID: <20121108050439.GK5103@adacore.com> References: <20121107201107.25258.47267.stgit@brno.lan> <509B2BCA.2050703@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <509B2BCA.2050703@codesourcery.com> User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-11/txt/msg00171.txt.bz2 > What is the include order of "defs.h" and system headers, such as > and ? When I learnt C programming some years > ago, it was said system headers are included first, and then your > own headers. This rule doesn't apply here? My understanding is that "defs.h" should always be included first. It sets things up nicely for the rest of the includes (such as including the various config.h files, which can have an effect on how other system includes are expanded). Eg: /* Enable extensions on AIX 3, Interix. */ #ifndef _ALL_SOURCE # undef _ALL_SOURCE #endif For the rest, I don't really know if there is a recommended order, or not. I don't think we're completely consistent on that. I think I've seen code that intermingles both. -- Joel