linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rahul Karnik <rahul@genebrew.com>
To: Valdis.Kletnieks@vt.edu
Cc: Jeff Sipek <jeffpc@optonline.net>,
	Timothy Miller <miller@techsource.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][TRIVIAL] Bugzilla bug # 322 - double logical operator drivers/char/sx.c
Date: Thu, 07 Aug 2003 00:00:23 -0400	[thread overview]
Message-ID: <3F31CED7.2070207@genebrew.com> (raw)
In-Reply-To: <200308070312.h773Ce6h004590@turing-police.cc.vt.edu>

Valdis.Kletnieks@vt.edu wrote:
> On Wed, 06 Aug 2003 21:26:30 EDT, Jeff Sipek said:
> 
> 
>>>Can you really DO (x < y > z) and have it work as an anded pair of
>>>comparisons?  Maybe this is an addition to C that I am not aware of.
>>>
>>>I would expect (x < y > z) to be equivalent to ((x < y) > z).
>>
>>Ah, very true. I wonder what the author intended. Also, since the 'z' is 0 in
>>all the cases, the statement "(i < TIMEOUT) > 0" can be reduced to "i < 
>>TIMEOUT".
> 
> 
> Of course, if the author intended (x<y) && (x > 0), you can't reduce it if
> x is at all possibly negative....

Doesn't matter; x is a loop index incrementing from 0 in this case.

Actually (correct me if I am wrong, but doesn't:

for(int i = 0; i < TIMEOUT > 0; i++)

translate to:

for(int i = 1; i < TIMEOUT; i++)

rather than:

for(int i = 0; i < TIMEOUT; i++)?

I hav not looked at the actual context of the code, but at least 
mathematically that makes more sense to me. i should never be 0 in the 
body of the loop, methinks?

Thanks,
Rahul
-- 
Rahul Karnik
rahul@genebrew.com


  reply	other threads:[~2003-08-07  3:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-08-06 22:30 [PATCH][TRIVIAL] Bugzilla bug # 322 - double logical operator drivers/char/sx.c Josef 'Jeff' Sipek
2003-08-07  0:32 ` Krzysztof Halasa
2003-08-07  0:35 ` Timothy Miller
2003-08-07  1:26   ` Jeff Sipek
2003-08-07  3:12     ` Valdis.Kletnieks
2003-08-07  4:00       ` Rahul Karnik [this message]
2003-08-07  4:12         ` Rahul Karnik
2003-08-07  1:29   ` Josef 'Jeff' Sipek
2003-08-07  8:20   ` Jeff Sipek
2003-08-07 23:02     ` jw schultz
2003-12-21  6:55 Josef 'Jeff' Sipek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3F31CED7.2070207@genebrew.com \
    --to=rahul@genebrew.com \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=jeffpc@optonline.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miller@techsource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).