Content deleted Content added
Line 78:
* Not checking number and types of arguments when the function declaration has an empty parameter list. (This provides [[backward compatibility]] with [[The C Programming Language (book)|K&R C]], which lacked prototypes.)
* Some questionable choices of operator precedence, as mentioned by Kernighan and Ritchie above, such as <code>==</code> binding more tightly than <code>&</code> and <code>|</code> in expressions like <code>x & 1 == 0</code>.
* The use of the <code>=</code> operator, used in mathematics for equality, to indicate assignment, following the precedent of [[Fortran]], [[PL/I]], and [[BASIC]], but unlike [[ALGOL]] and its derivatives. Ritchie made this syntax design decision consciously, based primarily on the argument that assignment occurs more often than comparison.It should be noted that the vast majority of programming languages in use today use this. For those who have trouble understanding it, it might be helpful to think: 'x = 5' means 'make x equal 5'.
* Similarity of the assignment and equality operators (<code>=</code> and <code>==</code>), making it easy to substitute one for the other if you aren't familiar with the language. C's weak type system permits each to be used in the context of the other without a compilation error (although some compilers produce warnings). For example, the conditional expression in <code>if (a=b)</code> is only true if <code>a</code> is not zero after the assignment.<ref>http://www.cs.ucr.edu/~nxiao/cs10/errors.htm 10 Common Programming Mistakes in C</ref>
* A lack of [[infix notation|infix]] operators for complex objects, particularly for string operations, making programs which rely heavily on these operations difficult to read.
* A declaration syntax that some find unintuitive, particularly for [[function pointer]]s. (Ritchie's idea was to declare identifiers in contexts resembling their use: "[[declaration reflects use]]".)
|