(!( && !

Started by
13 comments, last by Tazel 21 years, 2 months ago
the parens tell the operand ( ''!'' in this case ) what context to evaluate.

Rate me up.
Advertisement
You understand Order of Operations, right Tazel? You know that

2 + 1 * 6 is different than
(2 + 1) * 6 ?

We just added some more operations into the order of operations, that you might not be used to. So, when in doubt, use more parenthesis. Or look up "operator precedence" and see what tier it''s on.

-fel
~ The opinions stated by this individual are the opinions of this individual and not the opinions of her company, any organization she might be part of, her parrot, or anyone else. ~
This is why, if you feel the need to use macros, you must make liberal use of parentheses in the macro if it starts to gain much any kind of complexity, unless it''s the intended behaviour.
______________________________________________________________________________________The Phoenix shall arise from the ashes... ThunderHawk -- ¦þ"So. Any n00bs need some pointers? I have a std::vector<n00b*> right here..." - ZahlmanMySite | Forum FAQ | File Formats______________________________________________________________________________________
!(a && b) is equivalent to (!a || !b)

Knowing a little boolean logic can get you pretty far in programming. Example:

(a || (!a && b)) is equivalent to (a || b), and easier to read if using long variable names.

Think Liberally..
Fel: Yes. The parentheses and any grouping symbol''s contents are evaluated first.

Then powers.

Then multiplication and division from left to right.

Then add. and sub. from left to right.


tcache
Contact Me
-----------
AH! MY BRAIN IS GOING TO SELF-DETONATE! -- Yours Truly (Jan, 2003)
tcacheContact Me-----------AH! MY BRAIN IS GOING TO SELF-DETONATE! -- Yours Truly (Jan, 2003)

This topic is closed to new replies.

Advertisement