Is your system polluted?

Ron Guilmette rfg at ics.uci.edu
Sat Dec 23 18:06:24 AEST 1989


In article <1552 at aber-cs.UUCP> pcg at 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



More information about the Comp.unix.wizards mailing list