Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84 SMI; site sun.uucp Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxn!ihnp4!qantel!lll-crg!lll-lcc!vecpyr!amd!amdcad!decwrl!sun!guy From: guy@sun.uucp (Guy Harris) Newsgroups: net.lang.c,net.unix-wizards Subject: Re: Prepending _ in C external names necessary? Message-ID: <3040@sun.uucp> Date: Thu, 28-Nov-85 15:28:44 EST Article-I.D.: sun.3040 Posted: Thu Nov 28 15:28:44 1985 Date-Received: Sat, 30-Nov-85 06:48:07 EST References: <1232@hpda.UUCP> <851@kuling.UUCP> Organization: Sun Microsystems, Inc. Lines: 21 Xref: watmath net.lang.c:7245 net.unix-wizards:15912 > >We're considering changing our C compiler to *not* prepend an underscore > >at the beginning of all external names (functions, variables). > > I say don't do it! > > (Example where a variable is given the same name as the name used by a > register in the assembler, and all h*ll breaks loose when the code is > assembled, linked, and run) This was (according to DMR) the reason this was done in the first place. I believe the 3Bs assemblers do not pre-define names like "r0" for the registers (I think you say something like "%0"), so they can get away with it. Just make sure that, if you don't prepend an underscore, your assembler has a symbol table completely devoid of built-in symbols when it's started up (i.e., don't put opcodes, registers, etc. into the symbol table). If you do this, the only think you're likely to break is programs that use "nlist" to get symbol names from the kernel or something like that - S5 programs which use "nlist" have "#if u3b"-type stuff around the declaration of the namelist. Guy Harris