The original was written in K&R C, so I had to account for the possibility that they had changed a syntax rule that disallowed this with ANSI C. Furthermore, you have syntax like trigraphs that are perfectly valid C syntax, but gcc won't transform them by default unless you pass a flag. If you see my edit, it looks like you're right, it's fine, though I'm surprised I got no warnings.
In computer programming, digraphs and trigraphs are sequences of two and three characters, respectively, that appear in source code and, according to a programming language's specification, should be treated as if they were single characters.
Various reasons exist for using digraphs and trigraphs: keyboards may not have keys to cover the entire character set of the language, input of special characters may be difficult, text editors may reserve some characters for special use and so on. Trigraphs might also be used for some EBCDIC code pages that lack characters such as { and }.
View all comments
Show parent comment
6
u/bucket3432 Feb 20 '20
The original was written in K&R C, so I had to account for the possibility that they had changed a syntax rule that disallowed this with ANSI C. Furthermore, you have syntax like trigraphs that are perfectly valid C syntax, but
gccwon't transform them by default unless you pass a flag. If you see my edit, it looks like you're right, it's fine, though I'm surprised I got no warnings.