473,564 Members | 2,758 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is FALSE == 0?

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.
Nov 14 '05 #1
17 2539
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
Nov 14 '05 #2
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.
Nov 14 '05 #3
In article <3h************ **@read3.inet.f i>,
Tatu Portin <ax****@mbnet.f i> 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/
Nov 14 '05 #4
Goran Larsson wrote:
In article <3h************ **@read3.inet.f i>,
Tatu Portin <ax****@mbnet.f i> 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.


Thanks. Just if you could give some www-adress for reference.
Nov 14 '05 #5
Tatu Portin wrote:
Goran Larsson wrote:
Tatu Portin <ax****@mbnet.f i> wrote:
I would like if you could point to some definition of the c
language.


The ANSI/ISO/IEC 9899-1999 standard.


Thanks. Just if you could give some www-adress for reference.


The standard is available for about 270 USD as paper copy or from
webstore.ansi.o rg for 18 USD as .pdf file.
(
http://webstore.ansi.org/ansidocstor...EC+9899%2D1999
)

For most beginners, N869, the last public (and freely available) draft
is quite enough. Use google to obtain it.

Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Nov 14 '05 #6
Tatu Portin wrote:
Goran Larsson wrote:
In article <3h************ **@read3.inet.f i>,
Tatu Portin <ax****@mbnet.f i> 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.


Thanks. Just if you could give some www-adress for reference.

I believe your c-book whichever it is should be able to answer this
question.
If it does not maybe you need another book.

--
Imanpreet Singh Arora
Nov 14 '05 #7
Michael Mair <Mi**********@i nvalid.invalid> writes:
[...]
The standard is available for about 270 USD as paper copy or from
webstore.ansi.o rg for 18 USD as .pdf file.
(
http://webstore.ansi.org/ansidocstor...EC+9899%2D1999
)

For most beginners, N869, the last public (and freely available) draft
is quite enough. Use google to obtain it.


For most beginners, a good book is going to be much more useful than a
copy of the standard. K&R2 is one of the best (_The C Programming
Language_, 2nd Edition, by Kernighan & Ritchie).

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #8
Tatu Portin <ax****@mbnet.f i> writes:
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.


Read section 9 of the C FAQ, <http://www.eskimo.com/~scs/C-faq/top.html>.
(If you forget the URL, just google "C FAQ".)

--
Keith Thompson (The_Other_Keit h) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Nov 14 '05 #9
Hi Keith,

Keith Thompson wrote:
Michael Mair <Mi**********@i nvalid.invalid> writes:
[...]
The standard is available for about 270 USD as paper copy or from
webstore.ansi .org for 18 USD as .pdf file.
(
http://webstore.ansi.org/ansidocstor...EC+9899%2D1999
)

For most beginners, N869, the last public (and freely available) draft
is quite enough. Use google to obtain it.


For most beginners, a good book is going to be much more useful than a
copy of the standard. K&R2 is one of the best (_The C Programming
Language_, 2nd Edition, by Kernighan & Ritchie).


Mind the "quite" :-)
The OP asked for the standard, I gave the answer.
He can have a look at N869 and see and believe that going back to
"ordinary" C books might be a better idea. Sometimes, you have to
do it for yourself...
Apart from K&R2, I also always refer the people to the c.l.c FAQ.
Cheers
Michael
--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Nov 14 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
1748
by: Sylvain Thenault | last post by:
Hi there ! Can someone explain me the following behaviour ? >>> l = >>> 0 in (l is False) Traceback (most recent call last): File "<stdin>", line 1, in ? TypeError: iterable argument required >>> (0 in l) is False
3
2556
by: drs | last post by:
I just upgraded my Python install, and for the first time have True and False rather than 1 and 0. I was playing around at the command line to test how they work (for instance, "if 9:" and "if True:" both lead to the conditional being executed, but True == 9 -> False, that this would be true was not obvious to me -- "True is True" is True,...
15
2311
by: F. Da Costa | last post by:
Hi all, Following two sniperts of code I'm using and getting very interesting results from. ..html <tr id="1" class="segment" open="false"> This is the segment under 'investigation' ..js
10
3275
by: tony | last post by:
Hello!! I have some demo programs written in C# and they have this construction "" see below. I haven't seen this before so what does it mean ? public bool ShowDropDownButtons { get { return showDropDownButtons; }
14
3320
by: Prateek | last post by:
I've been using Python for a while (4 years) so I feel like a moron writing this post because I think I should know the answer to this question: How do I make a dictionary which has distinct key-value pairs for 0, False, 1 and True. As I have learnt, 0 and False both hash to the same value (same for 1 and True). {0: 'abc'} # Am I the...
0
7665
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7583
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7888
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8106
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
6255
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2082
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.