Question on "if" statements...

From: David Cleaver (wraithx_at_morpheus.net)
Date: 04/26/04


Date: Mon, 26 Apr 2004 02:48:58 -0500

Hello all,

I was wondering if there were some sort of limitations on the "if"
statement? I'm writing a program which needs to check a bunch of
conditions all at the same time (basically). And I'm pretty sure the
rest of the program is working just fine. The only thing I could think
might be wrong is that the if statement can only hold so many values in
itself? Let me show what I'm doing:

if (table001[n[0]][x[0]>>5]&b[x[0]&0x1f] != 0 &&
    table002[n[1]][x[1]>>5]&b[x[1]&0x1f] != 0 &&
    table003[n[2]][x[2]>>5]&b[x[2]&0x1f] != 0 &&
    ... &&
    table030[n[29]][x[29]>>5]&b[x[29]&0x1f] != 0)
{
    do_stuff();
}//end if
else do_other_stuff();

My problem is that "do_stuff" is never executed. There are 30 different
tables of int's I'm checking against up there. I could use more in the
future, and for the purposes of my program, I don't want to use less. I
know that do_stuff should be executed because I have run test cases
where it should have been run. But it just keeps goin to the "else"
statement. I'm probably way off base thinking C is the problem. If you
want to know about my setup here it is:
WinXP, P4 1.8, Compiler: DJGPP using gcc v3.0.3

So, am I expecting too much out of the if statement? Am I using the if
statement incorrectly up there? Any advice or help in this regard is
greatly appreciated.

-David C.



Relevant Pages

  • Re: Pythons "only one way to do it" philosophy isnt good?
    ... f.write('a bunch of stuff') ... This is the sort of code that I warn against writing. ... This will not immediately close f if f.write raises an exception since the program stack is kept alive as a traceback. ...
    (comp.lang.python)
  • Re: quick question - yes or no?
    ... invested, say, three years in writing something, they might be left ... The big money goes to the ... interest in writing bunch of crap novels. ...
    (misc.writing)
  • Re: quick question - yes or no?
    ... invested, say, three years in writing something, they might be left ... The big money goes to the ... interest in writing bunch of crap novels. ...
    (misc.writing)
  • Re: Which of these authors is still worth reading?
    ... I hate this question, I hate it very, very much. ... I think you need to stop, and think about what the word means, before you start asking this sort of question. ... You must begin with a question, that by itself, is not subject to multiple interpretations. ... this is pretty much like the idea of people writing "evaluations" for employees. ...
    (rec.arts.sf.written)
  • Re: Wondering if its worth continuing
    ... Are you the sort of person who needs to ... much advance planning for her backbrain to put up with. ... What, exactly, are you doing to contrast your historians and your ... scene or twist that you're looking forward to writing, ...
    (rec.arts.sf.composition)