Re:C for All
by mafuy on Tuesday March 27, 2018 @05:27PM
(#16692887)
Just dropping in to say you are completely correct. It is called "maximum munch" and mandated by the C spec. I recently wrote a toy C compiler and was confused until I learned this.
'||' and '&&' are distinct tokens in C as far as i know, i.e. not handled as two consecutive '|'s or '&'s.
So your example would unambiguously be parsed as "a to the b:th power". Whereas the other case would need explicit parens:
Similar example for &: