I like the current gcc handling of trigraphs

Thomas R. Truscott trt@cs.duke.edu
Wed Jun 5 09:01:00 GMT 2002


[Just in case someone is planning changes to gcc trigraph handling...]

Please don't change the current gcc trigraph handling,
at least not with out more discussion.

In my opinion/experience, the C trigraph feature is a total mismake:

1) It solves a problem that no one actually has,
  and/or one that can be solved at least as easily in some other way.
2) It adds an unintuitive complexity to the language.
  I have learned that only a tiny fraction of C programmers
  know what C trigraphs are, and exactly what they do.
     printf("(Is this ridiculous, or what??)\n");
 3) It causes real harm in real programs.  For example see:
    http://groups.google.com/groups?hl=en&lr=&selm=70jbai%24l9b%241%40hal.cs.duke.edu

The most helpful and portable defense against trigraphs is a
warning that they exist in the source code.
It is good for gcc to have -Wtrigraphs, and to have it enabled by -Wall.

A good (but non-portable) defense is an option to disable
trigraph processing.  gcc has one, and the company for which I work
has asked other compiler vendors to provide one as well.
For example, newer Solaris compilers support -xtrigraphs=no

We should work towards removing this blight on the language.
Enabling trigraphs in gcc would be a step in the wrong direction.

Tom Truscott



More information about the Gcc mailing list