prev up next   top/contents search

comp.lang.c FAQ list · Question 20.21b

Q: Is C a great language, or what? Where else could you write something like a+++++b ?

A: Well, you can't meaningfully write it in C, either. The rule for lexical analysis is that at each point during a straightforward left-to-right scan, the longest possible token is determined, without regard to whether the resulting sequence of tokens makes sense. The fragment in the question is therefore interpreted as

a ++ ++ + b
and cannot be parsed as a valid expression.

References: K&R1 Sec. A2 p. 179
K&R2 Sec. A2.1 p. 192
ISO Sec. 6.1
H&S Sec. 2.3 pp. 19-20

prev up next   contents search
about this FAQ list   about eskimo   search   feedback   copyright

Hosted by Eskimo North