In C/C++, is there a directive similar to #ifndef for typedefs?

后端 未结 11 2241
太阳男子
太阳男子 2020-12-15 16:03

If I want to define a value only if it is not defined, I do something like this :

#ifndef THING
#define THING OTHER_THING
#endif

What if

11条回答
  •  不思量自难忘°
    2020-12-15 16:10

    The solution I ended up using was including stdbool.h. I know this doesn't solve the question of how to check if a typedef is already defined, but it does let me ensure that the boolean type is defined.

提交回复
热议问题