[mlpack-svn] [MLPACK] #155: order of includes and include protections

MLPACK Trac trac at coffeetalk-1.cc.gatech.edu
Mon Oct 31 17:22:11 EDT 2011


#155: order of includes and include protections
--------------------------------------------------+-------------------------
  Reporter:  nslagle                              |        Owner:     
      Type:  wishlist                             |       Status:  new
  Priority:  major                                |    Milestone:     
 Component:  MLPACK                               |   Resolution:     
  Keywords:  includes, templates, style, nitpick  |     Blocking:     
Blocked By:                                       |  
--------------------------------------------------+-------------------------

Comment (by rcurtin):

 But the second layer of protection seems superfluous to me and just makes
 it more irritating for us to write .hpp and _impl.hpp files.  If a user,
 somewhere, includes file.hpp, then file.hpp will (always) include
 file_impl.hpp.  If they try to re-include file_impl.hpp by hand, it
 doesn't make a difference because of the standard include guards, and all
 our #error does is show them that they're kind of stupid.  But in my
 opinion, we shouldn't go to such lengths to tell people they're dumb.

 In other words, I can't see a possible case where the simpler approach
 fails to prevent unwanted behavior.  The only issue we need to catch is
 where someone includes file_impl.hpp before file.hpp, or, when they
 include file_impl.hpp but not file.hpp.  The simple approach catches that
 in every case.

-- 
Ticket URL: <http://trac.research.cc.gatech.edu/fastlab/ticket/155#comment:6>
MLPACK <www.fast-lab.org>
MLPACK is an intuitive, fast, and scalable C++ machine learning library developed by the FASTLAB at Georgia Tech under Dr. Alex Gray.


More information about the mlpack-svn mailing list