C++ Include Guards for Standard Headers

后端 未结 4 1732
悲哀的现实
悲哀的现实 2021-01-13 00:36

I am wondering if/ what include guards on files like windows.h, math.h, iostream, stdio... etc.

Since I have thos

4条回答
  •  星月不相逢
    2021-01-13 01:34

    These files are located in /usr/include/ and subdirectories (at least on my debian laptop). Looking at /usr/include/stdio.h

    shows a typical guard,

    #ifndef _STDIO_H
    # define _STDIO_H       1
    

    And checking for cpp, grep __cplusplus,

    #if !defined __cplusplus || defined __STDC_LIMIT_MACROS
    

    ...

提交回复
热议问题