避免缺乏bool类型的支持 [英] getting around lack of bool type support

查看:148
本文介绍了避免缺乏bool类型的支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用mikroC来编写C语言中的一些微控制器代码。但是我b / b
遇到了bool类型不支持的潜在问题
来自编译器投诉的
我如何声明类型bool变量。来自

我从mikroBasic中抽出的论坛帖子,我意识到

bool类型并不完全支持。在mikroC中进行编程时,我得到了一个无效表达式的错误消息。当我宣布

bool类型变量时,说明符需要当我在函数参数中声明bool类型

变量时,以及当我将bool

类型变量声明为文件范围时。我不确定这个邮件列表上是否有任何mikroC

用户,但非常感谢任何评论或

建议。谢谢。

I am using mikroC to program some microcontroller code in C. However I
have come across of potential problem of bool type not being supported
from the compiler complaint on how I declared type bool variable. From
a forum thread that I''ve pulled out from mikroBasic, I realized that
bool type isn''t fully supported. When programming in mikroC, I have
been getting an error message of "invalid expression" when I declared
a bool type variable, "specifier needed" when I declared the bool type
variable within a function parameter and also when I declared the bool
type variable as a file scope. I''m not sure if there are any mikroC
users on this mailing list, but would much appreciate any comments or
suggestions. Thanks.

推荐答案

12月29日凌晨2:21,ssylee< staniga ... @ gmail.comwrote:
On Dec 29, 2:21 am, ssylee <staniga...@gmail.comwrote:

我正在使用mikroC来编写C语言中的一些微控制器代码。但是我b / b
遇到了bool类型不支持的潜在问题
$ b来自编译器投诉的$ b我如何声明类型bool变量。来自

我从mikroBasic中抽出的论坛帖子,我意识到

bool类型并不完全支持。在mikroC中进行编程时,我得到了一个无效表达式的错误消息。当我宣布

bool类型变量时,说明符需要当我在函数参数中声明bool类型

变量时,以及当我将bool

类型变量声明为文件范围时。我不确定这个邮件列表上是否有任何mikroC

用户,但非常感谢任何评论或

建议。谢谢。
I am using mikroC to program some microcontroller code in C. However I
have come across of potential problem of bool type not being supported
from the compiler complaint on how I declared type bool variable. From
a forum thread that I''ve pulled out from mikroBasic, I realized that
bool type isn''t fully supported. When programming in mikroC, I have
been getting an error message of "invalid expression" when I declared
a bool type variable, "specifier needed" when I declared the bool type
variable within a function parameter and also when I declared the bool
type variable as a file scope. I''m not sure if there are any mikroC
users on this mailing list, but would much appreciate any comments or
suggestions. Thanks.



#include< stdbool.h>

#include <stdbool.h>


ssylee写道,2007年12月29日00: 21:
ssylee wrote, On 29/12/07 00:21:

我正在使用mikroC来编写C语言中的一些微控制器代码。但是我已经遇到了bool类型的潜在问题而不是被支持

来自编译器投诉我如何声明类型bool变量。来自

我从mikroBasic中抽出的论坛帖子,我意识到

bool类型并不完全支持。在mikroC中进行编程时,我得到了一个无效表达式的错误消息。当我宣布

bool类型变量时,说明符需要当我在函数参数中声明bool类型

变量时,以及当我将bool

类型变量声明为文件范围时。我不确定这个邮件列表上是否有任何mikroC

用户,但非常感谢任何评论或

建议。谢谢。
I am using mikroC to program some microcontroller code in C. However I
have come across of potential problem of bool type not being supported
from the compiler complaint on how I declared type bool variable. From
a forum thread that I''ve pulled out from mikroBasic, I realized that
bool type isn''t fully supported. When programming in mikroC, I have
been getting an error message of "invalid expression" when I declared
a bool type variable, "specifier needed" when I declared the bool type
variable within a function parameter and also when I declared the bool
type variable as a file scope. I''m not sure if there are any mikroC
users on this mailing list, but would much appreciate any comments or
suggestions. Thanks.



我对mikroC(或microBasic)一无所知但我*知道

布尔类型(拼写为_Bool)只是添加了1999年标准中的C语言

大多数编译器都没有完全实现(并且一个重要的

数字根本没有实现它)。此外,它仅拼写为bool。如果

你已经包含了stdbool.h


在C中你可以使用任何整数类型进行布尔工作只要你

理解0如果为false且* any *非零值为真,那么不要
定义一个名为true的常量或TRUE或TRUE并对它进行比较。

-

Flash Gordon

I know nothing of mikroC (or microBasic) but I *do* know that the
boolean type (spelled _Bool) was only added to C in the 1999 standard
which is not implemented fully by most compilers (and a significant
number do not implement it at all). Further, it is only spelt "bool" if
you have included stdbool.h

In C you can use any integral type for boolean work as long as you
understand that 0 if false and *any* non-zero value is true, so don''t
define a constant named "true" or "TRUE" and do comparisons against it.
--
Flash Gordon


12月28日下午4:21, ssylee< staniga ... @ gmail.comwrote:
On Dec 28, 4:21 pm, ssylee <staniga...@gmail.comwrote:

我正在使用mikroC来编写C中的一些微控制器代码。但是我

已经遇到了bool类型不被支持的潜在问题

来自编译器投诉我如何声明类型bool变量。来自

我从mikroBasic中抽出的论坛帖子,我意识到

bool类型并不完全支持。在mikroC中进行编程时,我得到了一个无效表达式的错误消息。当我宣布

bool类型变量时,说明符需要当我在函数参数中声明bool类型

变量时,以及当我将bool

类型变量声明为文件范围时。我不确定这个邮件列表上是否有任何mikroC

用户,但非常感谢任何评论或

建议。谢谢。
I am using mikroC to program some microcontroller code in C. However I
have come across of potential problem of bool type not being supported
from the compiler complaint on how I declared type bool variable. From
a forum thread that I''ve pulled out from mikroBasic, I realized that
bool type isn''t fully supported. When programming in mikroC, I have
been getting an error message of "invalid expression" when I declared
a bool type variable, "specifier needed" when I declared the bool type
variable within a function parameter and also when I declared the bool
type variable as a file scope. I''m not sure if there are any mikroC
users on this mailing list, but would much appreciate any comments or
suggestions. Thanks.



如果你想在你的系统上尝试编译现有代码并且没有bool

,请尝试输入它。


typedef短布尔

#define true 1

#define false 0


问候,

Ivan Novick
http://www.0x4849.net


这篇关于避免缺乏bool类型的支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆