the parens tell the operand ( ''!'' in this case ) what context to evaluate.
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
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
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.
!(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..
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)
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)
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement