This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Always include defs.h first.


> What is the include order of "defs.h" and system headers, such as
> <ctype.h> and <stdio.h>?  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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]