Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > Is there a shorter solution ?

Reply
Thread Tools

Is there a shorter solution ?

 
 
Keith Thompson
Guest
Posts: n/a
 
      08-12-2011
Kenneth Brody <(E-Mail Removed)> writes:
> On 8/10/2011 1:17 PM, Ben Pfaff wrote:
> [...]
>> Yes, the C standard says so, e.g.:
>>
>> 6.5.13 Logical AND operator
>>
>> The&& operator shall yield 1 if both of its operands
>> compare unequal to 0; otherwise, it yields 0. The result has
>> type int.
>>
>> ....
>>
>> 6.5.14 Logical OR operator
>>
>> The || operator shall yield 1 if either of its operands
>> compare unequal to 0; otherwise, it yields 0. The result has
>> type int.

>
> Did K&R say anything about this? I seem to recall using a compiler in K&R1
> days which used -1 rather than 1. (But that was many years ago, and I may
> be misremembering things.)


<http://cm.bell-labs.com/cm/cs/who/dmr/cman.pdf> is a C reference manual
from 1975, 3 years before K&R1. 7.12 says:

The || operator returns 1 if either of its operands is nonzero, and
0 otherwise.

<http://cm.bell-labs.com/cm/cs/who/dmr/cman74.pdf>, from Jan 1974, says
the same thing (it's a scan of a printout).

--
Keith Thompson (The_Other_Keith) http://www.velocityreviews.com/forums/(E-Mail Removed) <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Is there a shorter, more elegant way to write this deep hashlookup statement Dr.Ruud Perl Misc 1 02-21-2013 04:37 PM
Re: Is there a shorter, more elegant way to write this deep hashlookup statement C.DeRykus Perl Misc 0 02-19-2013 07:40 PM
Re: Is there a shorter, more elegant way to write this deep hash lookup statement George Mpouras Perl Misc 0 02-17-2013 12:07 PM
Any solution shorter than this ? HumbleWorker C Programming 4 08-06-2011 07:19 PM
is there a shorter way to compare these 2 objects? Lowell Kirsh Ruby 5 08-18-2005 10:56 PM



Advertisments