Prepending _ in C external names necessary?
Guy Harris
guy at sun.uucp
Fri Nov 29 06:28:44 AEST 1985
> >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
More information about the Comp.lang.c
mailing list