Right, im learning assembly - however, ive only done limited C and C++ (which i regard as being rubbish).
My question:
Does the underscores in front of a variable change it in some way?
Thx :U
If you have programmed in c before, you should know that the c/c++ compiler prefixes any global symbols with underscores durring compilation. In assembly language, the underscore is for the most part just another character.
varname label dword
_varname label dword
__varname label dword
___varname label dword
the above code demonstrates that all four of those names are unique. The above code sample works fine. Insidently, to get around ambiguity caused by say someone naming a global variable var1 (which would soon be prefixed with an underscore durring compile) and then declairing a local variable called _var1 (which you would expect to clash with the global) the visual c++ compiler seems to use name decoration to avoid conflicts.
The underscore (and all other name decorations) is not added during the middle of a compile. It is added only when the OBJ file is created. The name decoration is for the linker's benefit, not the compiler's. The linker requires unique names, and name decoration differentiates between overloaded functions. It also provides an indirect form of type checking when linking.
As MusicalMike says, the underscore is simply another character, and it's treated the same as a letter. It has no special meaning to the assembler, nor to the linker.
Thanks :U