#include header guard format?

后端 未结 13 1609
广开言路
广开言路 2020-12-05 07:46

I know it makes little difference to a project but, assuming you use #defined header guards for your C++ code, what format do you use? e.g. assuming a header called f

相关标签:
13条回答
  • 2020-12-05 08:30

    I've also always used something along the lines of:

    #ifndef FOO_HPP
    #define FOO_HPP 1
    
    ...
    
    #endif
    

    As most people have mentioned, don't prepend symbols with double underscores as that is reserved by the C++ standard for internal use by the implementation.

    You might like to look at John Lakos's excellent book "Large Scale C++ Software Design" (Amazon link - sanitised for the script kiddy link nazis) for some considerations regarding header includes.

    HTH

    cheers,

    Rob

    0 讨论(0)
提交回复
热议问题