Naming Include Guards

前端 未结 9 1283
忘了有多久
忘了有多久 2020-11-29 08:37

How are C++ include guards typically named? I tend to see this a lot:

#ifndef FOO_H
#define FOO_H

// ...

#endif

However, I don\'t think

9条回答
  •  广开言路
    2020-11-29 08:39

    From my own experience, the convention is to name the inclusion guards after the header file containing them with the exception that the name is all in caps and the period is replaced with an underscore.

    So test.h becomes TEST_H.

    Real life examples of this include Qt Creator, which follows this convention when auto-generating class header files.

提交回复
热议问题