Why C Is Not My Favourite Programming Language

27th August 2002

Ahem.

C is sometimes castigated for the syntax of its declarations, particularly ones that involve pointers to functions. The syntax is an attempt to make the declaration and the use agree; it works well for simple cases, but it can be confusing for the harder ones, because declarations cannot be read left to right, and because parentheses are over-used. The difference between int *f() and int (*pf) illustrates the problem
[...]
	char (*(*x[3])())[5]
	    x: array[3] of pointer to function returning
	    pointer to array[5] of char
	
- Kernighan & Ritchie, The C Programming Language, 2nd Edition, Chapter 5 (Pointers and Arrays), section 5.12 (Complicated Declarations)

Oh, and:

All whitespace is equivalent except in certain situations.
- Footnote 82 to the ANSI C standard.

Case closed.

Feedback to <mike@miketaylor.org.uk> is welcome!