#include header guard format?

后端 未结 13 1653
广开言路
广开言路 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:07

    I tend to use:

    #ifndef FILE_DATE_H_
    

    (replace _H_ with the appropriate extension like _HPP_, etc). The date stamp is to avoid collisions with other same named headers in other directions/libraries.

    so in the end it looks like this:

    #ifndef SOMEFILE_20082411_H_
    

提交回复
热议问题