Xref: utzoo comp.unix.wizards:19896 gnu.gcc:1223 Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!usc!snorkelwacker!bloom-beacon!eru!luth!sunic!mcsun!ukc!dcl-cs!aber-cs!rupert!pcg From: pcg@rupert.cs.aber.ac.uk (Piercarlo Grandi) Newsgroups: comp.unix.wizards,gnu.gcc Subject: Re: Is your system polluted? Message-ID: Date: 25 Dec 89 21:50:18 GMT References: <1552@aber-cs.UUCP> <259323F0.15070@paris.ics.uci.edu> Sender: pcg@aber-cs.UUCP Distribution: gnu Organization: Coleg Prifysgol Cymru Lines: 39 In-reply-to: rfg@ics.uci.edu's message of 23 Dec 89 07:06:24 GMT In article <259323F0.15070@paris.ics.uci.edu> rfg@ics.uci.edu (Ron Guilmette) writes: 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. I agree 100%. I agree so much that then I can propose the equivalently safe, but almost 100% backward trick that makes the ridiculous volatile keyword useless without virtually loss in optimization ability and with abosulte safety: have an option to make "register" the *default* storage class for block local variables. The only variables that need to be explicitly declared "auto" are then those whose address is taken, and the compiler will without any problem flag them out for you. If you have instead the equivalent trick of having variables unvolatile by default, you need to manually tag as volatile those that need be, and if you don't, you get nasty bugs. I reckon that an option to disable volatile and make register the default storage class for locals would provide virtually all the benefits as to optimization (caching globals is virtually irrelevant), without any risk, and would make it very easy to develop or upgrade existing programs that relied on Classic C semantics (e.g. the Unix kernel) in a multithreaded environment. Consider GNU C under Mach... -- Piercarlo "Peter" Grandi | ARPA: pcg%cs.aber.ac.uk@nsfnet-relay.ac.uk Dept of CS, UCW Aberystwyth | UUCP: ...!mcvax!ukc!aber-cs!pcg Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@cs.aber.ac.uk