Jam*_*ris 22 c linux gcc boolean
我想_Bool在我的系统上找到定义,因此对于缺少它的系统,我可以实现它.我在这里和其他网站上看到过各种各样的定义,但是想要检查系统的最终定义.
轻微的问题,因为我找不到_Bool定义的地方甚至stdbool.h
mussys@debmus:~$ find /usr/include/* -name stdbool.h
/usr/include/c++/4.3/tr1/stdbool.h
Run Code Online (Sandbox Code Playgroud)
而grep对于_Bool上/usr/include/*和/usr/include/*/*不要么找到它.
那它在哪里?
CB *_*ley 13
_Bool 是一个内置类型,所以不要指望在头文件中找到它的定义,甚至是系统头文件.
话虽如此,从你正在搜索的路径猜测你的系统,你有没有看过/usr/lib/gcc/*/*/include?
我的"真实" stdbool.h生活在那里.正如预期的那样它#defineš bool是_Bool.作为_Bool编译器的本机类型,头文件中没有它的定义.
作为一个说明:
_Bool在C99中定义.如果您使用以下内容构建程序:
gcc -std=c99
Run Code Online (Sandbox Code Playgroud)
你可以期待它在那里.
其他人已经回答了关于_Bool位置和是否声明C99的问题......但是,我对每个人都给出的自制声明不满意。
你为什么不完全定义类型?
typedef enum { false, true } bool;
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
40894 次 |
| 最近记录: |