Re: operating with binary



Frederick Gotham wrote:
Dave Thompson posted:

.... snip ...

unsigned to_and_with = 1U << CHAR_BIT - 1;

You wanted 1U << (CHAR_BIT - 1).

Kindly consult an operator precedence table.

No, Dave is right. The parentheses, whether or not necessary in C,
greatly improve the readability. Whenever the order
"multiplicative, additive, logical" does not suffice parentheses
are in order.

--
Some informative links:
news:news.announce.newusers
http://www.geocities.com/nnqweb/
http://www.catb.org/~esr/faqs/smart-questions.html
http://www.caliburn.nl/topposting.html
http://www.netmeister.org/news/learn2quote.html


.



Relevant Pages

  • Re: Percentage between two values
    ... But when I'm reading code that implements a hash ... don't want to think about operator precedence. ... > marketing ploy saying I could win a prize if I could solve this problem: ... > parentheses were suspiciously out of place), ...
    (microsoft.public.vb.general.discussion)
  • Re: indentation
    ... represent the program name in some way, but need not be a string ... The value of argc shall be nonnegative. ... Please explain why parentheses make the return code more readable. ...
    (comp.lang.c)
  • Re: VB6 Exponent Operator ?
    ... Without parentheses, ... VB uses operator precedence as listed in its documentation. ... But adding the negation operator makes it an expression that needs to be ... exponant operator is just above the negation operator, meaning, with no ...
    (microsoft.public.vb.general.discussion)
  • Re: Casting the return value of malloc()...
    ... in this specific case I never bother with the parentheses because I ... cultural norm is to seize on tangential minutiae in responding. ...
    (comp.lang.c)
  • Re: Difference between a MACRO and a FUNCTION
    ... not 100% convinced that the parentheses are unnecessary. ... but that will cause the unparenthesized version to expand to a legal ... I don't consider this a good reason to not parenthesise a. ...
    (comp.lang.c)