Criticism of the C programming language: Difference between revisions

Content deleted Content added
Redquark (talk | contribs)
Redquark (talk | contribs)
Line 122:
int sixteen = 0x3e-0x2e;
 
Because ANSI C provides support for [[Scientific_notation#E_notation|scientific notation]] support, <code>e-</code> or <code>e+</code> is allowed as part of a number by the preprocessor. Since token-matching is greedy, <code>0x3e-0x2e</code> is converted to a single preprocessing token. However, because of the mix of [[floating-point]] and [[hexadecimal]] notation, the subsequent conversion of that to a token in a later phase of translation is ill-defined. In this particular case, spaces around the minus sign must be added so the compiler can obtain the intended tokenization:
 
int sixteen = 0x3e - 0x2e;