best-practice on C header files with #ifndef #define #endif

后端 未结 5 2182
误落风尘
误落风尘 2020-12-09 18:25

what is concerned best practice regarding the following \"pattern\"?

#ifndef BLAFOO_H
#define BLAFOO_H
/* ...
 * ...
 */
#endif /* BLAFOO_H */
5条回答
  •  醉话见心
    2020-12-09 19:16

    Name them BLAFOO_H (personnally I use BLAFOO_H_ where BLAFOO is the header file name ).

    Make sure your BLAFOO doesn't clash with other files/libraries/etc. you're using, e.g. have your project and/or module name be parth of that name.

    Identifiers starting with a _ is reserved for the implementation/compiler, so don't use that.

提交回复
热议问题