stdbool.h C99标准杂谈

清泛原创
include <stdbool.h> 找不到头文件???
bool 是C++中的关键字,C中不支持
所以C99标准中引入了头文件 stdbool.h,包含了四个用于布尔型的预定义宏:
#define true 1
#define false 0
#define bool _Bool
typdef int _Bool

但是很遗憾,Visual C++不支持C99,至少现在来看是没这个计划(参见http://en.wikipedia.org/wiki/C99)。所以stdbool.h就不能在vc里面用:
http://msdn.microsoft.com/en-us/library/02y9a5ye.aspx
Microsoft C conforms to the standard for the C language as set forth in the 9899:1990 edition of the ANSI C standard.

VS2012不支持:
https://social.msdn.microsoft.com/Forums/zh-CN/19818b42-3a4c-47bd-94d3-5dcde7f0df70/vs2012-c99

但是貌似自VS2013开始部分支持:
http://www.cnblogs.com/zenny-chen/p/3632071.html
http://tieba.baidu.com/p/2709929142

C99标准 杂谈

分享到:
评论加载中,请稍后...
创APP如搭积木 - 创意无限,梦想即时!
回到顶部