是FALSE == 0? [英] Is FALSE == 0?
问题描述
FALSE == 0?
换句话说,''function()''在所有平台上执行:
if((1 == 2)== 0)
function();
if((7!)== 0)
function();
如果你能指出c语言的某些定义我想要。
< blockquote> Quoth Tatu Portin on或about 2004-11-20:
是FALSE == 0?
换句话说,''function()''在所有平台上执行:
我最近问了一个类似的问题。这是谷歌档案
http://www.google.com/groups?selm=cn...s.uwaterloo.ca
-trent
Trent Buck写道:Quoth Tatu Portin on或about 2004-11-20:
是FALSE == 0换句话说,''function()''在所有平台上执行:
我最近问了一个类似的问题。这是谷歌档案
http://www.google.com/groups?selm=cn...s.uwaterloo.ca
-trent
来自
http://www.google.com/groups?selm=cn...s.uwaterloo.ca 所有返回布尔结果的运算符都被定义为返回0或
1,所以你可以做到这一点,或者至少可以,如果你不介意反转结果。
被定义为返回0或1 ,但是并没有说0或者是假的。
另外,我想如果有人可以在标准(C89,C99)中指出某个地方
它定义了这些值。
文章< 3h ************** @ read3.inet.fi>,
Tatu Portin< ax **** @ mbnet.fi>写道:
是FALSE == 0?
是。
if((1 == 2)== 0)
function();
是。
if((7!)== 0)
function();
不,这不会编译。
| if((!7)== 0)
| function();
是的。
如果你能指出c语言的某些定义我想要。
ANSI / ISO / IEC 9899-1999标准。
-
G?ran Larsson http://www.mitt-eget.com/
>
Is FALSE == 0?
In other words, does ''function ()'' execute on all platforms:
if ( (1 == 2) == 0 )
function ();
if ( (7!) == 0 )
function ();
I would like if you could point to some definition of the c language.
Quoth Tatu Portin on or about 2004-11-20:Is FALSE == 0?
In other words, does ''function ()'' execute on all platforms:
I asked a similar question recently. Here''s the google archive
http://www.google.com/groups?selm=cn...s.uwaterloo.ca
-trent
Trent Buck wrote:Quoth Tatu Portin on or about 2004-11-20:Is FALSE == 0?
In other words, does ''function ()'' execute on all platforms:
I asked a similar question recently. Here''s the google archive
http://www.google.com/groups?selm=cn...s.uwaterloo.ca
-trent
From
http://www.google.com/groups?selm=cn...s.uwaterloo.caAll operators that return a boolean result are defined to return 0 or
1, so you can do this, or at least could if you didn''t mind inverting
the result.
"Are defined to return 0 or 1", but does not say whetever 0 is false or not.
Also, I would like if one could point some place in standard (C89, C99) where
it defines these values.
In article <3h**************@read3.inet.fi>,
Tatu Portin <ax****@mbnet.fi> wrote:
Is FALSE == 0?
Yes.
if ( (1 == 2) == 0 )
function ();
Yes.
if ( (7!) == 0 )
function ();
No, this will not compile.
| if ( (!7) == 0 )
| function ();
Yes.
I would like if you could point to some definition of the c language.
The ANSI/ISO/IEC 9899-1999 standard.
--
G?ran Larsson http://www.mitt-eget.com/
这篇关于是FALSE == 0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!