Xref: utzoo comp.unix.wizards:19887 gnu.gcc:1222 Path: utzoo!utgpu!jarvis.csri.toronto.edu!clyde.concordia.ca!uunet!bu-cs!snorkelwacker!apple!usc!orion.oac.uci.edu!uci-ics!rfg From: rfg@ics.uci.edu (Ron Guilmette) Newsgroups: comp.unix.wizards,gnu.gcc Subject: Re: Is your system polluted? Message-ID: <259323F0.15070@paris.ics.uci.edu> Date: 23 Dec 89 07:06:24 GMT References: <1552@aber-cs.UUCP> Reply-To: Ron Guilmette Distribution: gnu Organization: University of California, Irvine - Dept of ICS Lines: 40 In article <1552@aber-cs.UUCP> pcg@cs.aber.ac.uk (Piercarlo Grandi) writes: >Actually things are even worse than Ron Guilmette says... I know, but I didn't want to scare people. >of second rate hackers put duplicate names in system headers, but they do >the following things as well: > [stuff deleted] > > 3) even worse, a lot of libraries contain externals that are not > declared static. This is very dangerous, because you may unwittingly > use the same name in your program, and then all hell breaks loose. A > particularly bad offender is curses. Since people generally seem to be so lazy about this particular aspect of "good" coding, I was thinking of suggesting a -fdefault-static option for GCC which would make the default linkage (or "storage-class", as you prefer) in the absence of an explicit specification "static" rather than "extern". This could even be useful for old code because you could compile a given system with it, and then try to link. The linker would tell you which items ought to be explicitly declared as extern, and you could then go and fix *just* those declaration up to be explicitly extern and recompile again with -fdefault-static, thereby minimizing extern visible symbols. >In C, where we don't have a proper modularization facility, the following >guidelines ought to be followed: > [stuff deleted] > > 2) File names should also start with the modules prefix... Too late. ANSI C mandates several include file names which do not follow this rule. >Naturally all these rules are palliatives; what we should really have... What we should really do is to start all over, but I'd rather not. :-) // rfg