Talk About Network

Google





Programming > C - C++ Learning > Re: && Operator...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 7 of 12 Topic 4095 of 4400
Post > Topic >>

Re: && Operator precedence

by Philip Potter <pgp@[EMAIL PROTECTED] > Apr 8, 2008 at 01:21 PM

André Castelo wrote:
>>>    FILE *f = fopen("some_file_name", "r");
>>>    void *v = malloc(SOME_NUMBER_OF_BYTES);
> 
> 
> Actually,
> 
> if (f) corresponds to if (f != 0).

Please don't snip attribution lines. Although my threaded newsreader
makes it look like you replied to me, you only quoted Jack Klein in your
message.

Moreover, Jack himself said upthread:

=== begin quote ===
   if (f == 0) // file opened OK
   if (v == 0) // memory allocated OK

....and finally, evaluating a built-in type all by itself is equivalent
to comparing it to 0, so:

   if (f) // f != 0, file opened OK
   if (v) // v != 0, memory allocated OK
=== end quote ===

so it seems he's perfectly aware that if(f) is equivalent to if(f!=0).
 




 12 Posts in Topic:
[C and C++] && Operator precedence
Aggro <spammerdream@[E  2008-04-07 20:24:45 
Re: [C and C++] && Operator precedence
Ulrich Eckhardt <dooms  2008-04-07 22:34:34 
Re: [C and C++] && Operator precedence
Hal Vaughan <hal@[EMAI  2008-04-08 00:20:31 
Re: [C and C++] && Operator precedence
Jack Klein <jackklein@  2008-04-07 21:48:22 
Re: [C and C++] && Operator precedence
Philip Potter <pgp@[EM  2008-04-08 08:55:35 
Re: && Operator precedence
=?ISO-8859-1?Q?Andr=E9_Ca  2008-04-08 04:06:10 
Re: && Operator precedence
Philip Potter <pgp@[EM  2008-04-08 13:21:46 
Re: [C and C++] && Operator precedence
Philip Potter <pgp@[EM  2008-04-07 23:12:16 
Re: [C and C++] && Operator precedence
Francis Glassborow <fr  2008-04-07 23:42:49 
Re: [C and C++] && Operator precedence
Anand Hariharan <znvyg  2008-04-08 04:48:45 
Re: [C and C++] && Operator precedence
Francis Glassborow <fr  2008-04-08 09:15:35 
Re: [C and C++] && Operator precedence
Anand Hariharan <znvyg  2008-04-08 16:00:12 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
localhost-V2008-12-19 Wed Jan 7 9:31:52 PST 2009.