Does the order of #include directives and "using" statements matter at the beginning of a C++ header file? -
i cleaning c++ header file , have noticed following:
#if !defined(header_h_) #define header_h_ #include <vector> #include <string> using namespace std; #include<stdio.h> #include "blar/obja/model.h" namespace blar{ class blar; } #include <blar/blar.h> #include <blar/objb/othermodel.h> using namespace blar; #include <utilities/otherthing.h> #include <qstringlist.h>
is bad practice, or of ramifications of each #include/using/namespace
related declaration depend on order? since there no code in between, wouldn't think so, i'm not familiar many subtleties...
if headers written doesn't matter. if have inter-dependencies makes great deal of difference.
// header 1 #undef foo #define foo 1 // header 2 #undef foo #define foo 2
that's silly example, it's easy, if you're not careful, similar conflicts without using preprocessor.
Comments
Post a Comment