Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!adm!vis!greg@bass.nosc.MIL From: greg@bass.nosc.MIL Newsgroups: comp.lang.c Subject: Re: MAJOR ANSI C FLAW (my opinion, of course) Message-ID: <9840@brl-adm.ARPA> Date: Sun, 18-Oct-87 14:03:21 EDT Article-I.D.: brl-adm.9840 Posted: Sun Oct 18 14:03:21 1987 Date-Received: Mon, 19-Oct-87 00:16:25 EDT Sender: news@brl-adm.ARPA Lines: 59 I think that this issue is important enough to add another message. There is a way to allow full external name significance without running afoul of old linkers, etc. A source to source translator can be provided which reduces the significance of C external identifiers to six monocase characters. The design of such a tool is sketched below. Given such a translator available in the public domain, the ANSI Standard can require that implementors either provide full significance throughout their environment or provide such a translator. The standard can also strongly recommend the former as a quality issue. I was willing to simply accept the restricted external namespace until the recent message (I forget the author, sorry) explaining what this will do to the interfaces to large packages, e.g., graphics and database packages. Such packages are becomming more and more common in C programming environments. This point woke me up to the severe impact a restricted external namespace will have on the quality of our programs. Even a slight increase in maintenance difficulties becomes a major expense and trial. As I recall, a software tool to reduce name significance has already been posted to net.sources. It probably uses Unix tools, and anyway it affects internal identifiers too, so its not suitable. Here's what I envision: The tranlator would begin by reading a table of external identifiers already seen and name substitutions already determined (in processing other modules or entered by hand when C source isn't available for a module) and then it would translate one or more modules. New external identifiers clashing with those previously seen would be given a unique prefix, so that their full spelling is still available as a comment and for those tools that can access it. After translating the modules, the augmented identifier table would be output. Programmers using debuggers, etc. can refer to the identifier table as needed. I do not think such a translator need know much about C syntax. Its mostly a matter of ignoring reserved words and noticing whether an identifier is mentioned outside of curly braces. A fancier implementation would avoid renaming typedefs, etc., but there would be no harm in translating all externally mentioned symbols (other than reserved words). I also think that such a tool can be quite fast, not greatly increasing compilation overhead. If you're interested in writing such a tool, please send me a note. I won't be able to take that on for a few weeks, and I think the sooner such a tool is available the better. Remember, it must be public domain and be fully portable. _Greg J. Greg Davidson Virtual Infinity Systems +1 (619) 452-8059 6231 Branting St; San Diego, CA 92122 USA greg@vis.uucp ucbvax--| telesoft--| greg%vis.uucp@nosc.mil decvax--+--sdcsvax--+--vis greg%vis.uucp@sdcsvax.ucsd.edu ihnp4--| nosc--|