MySQL Lists are EOL. Please join:

List:Internals« Previous MessageNext Message »
From:Mats Kindahl Date:April 6 2010 3:50pm
Subject:[style] #include header files should always be first in file
View as plain text  
Hi internals,

Recently, I've been running my head into several cases of "partial
include file dependencies", that is, part of an include header file is
dependent on another include file while another part is not.

This is a nightmare to administer and typically causes problems when
adding new types and/or creating new modules or subsystems. It also
makes it hard to reuse code since all the includes are entangled in an
intricate web of dependencies.

Therefore, I suggest the following style rule:

#include should always be first in file and can only be preceded by
comments, other includes, and optionally the header file include guard.

I personally see no reason to allow the header file include guard
before the all the #include, but I can accept that if necessary.

Implementation: change existing code to conform with this rule.

Just my few cents,
Mats Kindahl
Mats Kindahl
Senior Software Engineer
Database Technology Group
Sun Microsystems
[style] #include header files should always be first in fileMats Kindahl6 Apr
  • Re: [style] #include header files should always be first in fileKonstantin Osipov6 Apr