Standards-14
Other

Do not use A, B [8 points each, 3% max]

If A and B are expressions then expression A,B evaluates A, ignores its result, then evaluates B. The value of A,B is the value of B.

Do not use the comma operator for sequenced evaluation of expressions.


Use parentheses in preprocessor definitions where appropriate [5 points]

I don't expect you to define preprocessor macros, but some students do it anyway.

The preprocessor can define macros with parameters. For example,

  #define max(x,y) = (((x) > (y)) ? (x) : (y))
causes statement
  m = max(a+1,b);
to be replaced by
  m = (((a+1) > (b)) ? (a+1) : (b));
Notice that each parameter in the definition of max is enclosed in parentheses, as it should be, and the entire right-hand side is parenthesized. Ensure that substitutions cannot cause precedence rules to yield a reparse. For example
  #define successor(x) x+1
does not parenthesize. It causes
  m = 2*successor(n-i);
to be replaced by
  m = 2*n-i+1;
which is not what was intended. A correct definition of successor is
  #define successor(x) ((x)+1)