Edwin this thing is baffling. I know that && is priorty or I would
assume judging by how the warning was stated. Suggest parentheses around &&
within || or is it || Crap the whole point of it is to have a true statement
if the subject makes it through the checks then the program can continue
otherwise it stops at that point in the program. Correct?

                              Dantin

P.S. Need more input.

----- Original Message -----
From: "Edwin Groothuis" <[EMAIL PROTECTED]>
To: "Dantin" <[EMAIL PROTECTED]>
Cc: "Rom Mailing List" <[email protected]>
Sent: Tuesday, July 09, 2002 11:07 PM
Subject: Re: Suggest Parenthisese around || and &&


> On Tue, Jul 09, 2002 at 11:08:27PM -0600, Dantin wrote:
> >     Okay here is the code:
> >
> >     for( ; to ; to = to->next_in_room )
> >     {
> > --> if ( (!IS_NPC(to) && to->desc == NULL )
> > -->||   ( IS_NPC(to) && !HAS_TRIGGER(to, TRIG_ACT) )
> > --> ||    to->position < min_pos
> > -->-->    &&    !to->desc )
> >             continue;
> >
> >         if( ( type == TO_CHAR ) && to != ch )
> >             continue;
> >         if( type == TO_VICT && ( to != vch || to == ch ) )
> >             continue;
> >         if( type == TO_ROOM && to == ch )
> >             continue;
> >         if( type == TO_NOTVICT && (to == ch || to == vch) )
> >             continue;
> >
> >      The part of the code that has a double --> is what I put in. It
gives
> > me a warning that suggest parentheses. What can I do to fix that. Please
oh
> > please help.. Don't flame either. Or Help and flame at the same time
thats
> > fair.. hehehe Thanks
>
> Try to find out what has higher priority, AND statements or OR statements.
> Then try to find out what the if-statement has to accomplish.
> Then add some parentheses to make the compiler happy.
>
> Edwin
>
> --
> Edwin Groothuis      |           Personal website: http://www.MavEtJu.org
> [EMAIL PROTECTED]    |        Interested in MUDs? Visit Fatal Dimensions:
> bash$ :(){ :|:&};:   |                    http://www.FatalDimensions.org/
>


Reply via email to