Thought on an ANSI lint

Doug Gwyn gwyn at smoke.BRL.MIL
Thu Feb 23 08:24:14 AEST 1989


In article <1057 at vsi.COM> friedl at vsi.COM (Stephen J. Friedl) writes:
-     I am postulating that it would be helpful to have a lint
-option that make string literals "array of const char" rather
-than "array of char" and do type checking on that basis.

This is basically a good idea, since attempts to modify string
literals are non-portable.

-The Committee apparently considered this for the language itself
-but eventually rejected it (maybe some ANSI-kind-of-people could
-comment on this).  Perhaps they rejected it because it would have
-required that old code be retrofitted with /const/ everywhere,
-and they felt this was too high a burden to place on those using
-a new compiler.

No, the main counterargument was that there is a lot of existing
code that depends on the ability to modify string literals (e.g.
mktemp() on UNIX), so compilers for those clientele would best
preserve that property.



More information about the Comp.std.c mailing list