Home > Back-end >  C functions
C functions

Time:09-23

Forgive me for just learning c + +, the question of the function name, c + + is how to tell the difference between a few function name as function???????

CodePudding user response:

The number of parameters or types,

Name modification agreement:

1, the decorated name (Decoration name) : "C" or "C + +" function in the internal (compile and link) through the decorated name recognition
2, the C compiler function name modified agreed rules:
__stdcall calling convention before the output function name prefix with an underscore, followed by a "@" symbol and the number of bytes of the parameters, the format for _functionname @ number, for example: the function (int a, int b), and its modification is called: _function @ 8
__cdecl calling convention before the output function name only add an underscore prefix, format for _functionname,
__fastcall calling convention before the output function name with a "@" symbol, the back is also a "@" symbol and the number of bytes of its parameters, format for @ functionname @ number,

3, c + + compiler function name modified agreed rules:
__stdcall calling convention:
1) to "?" Identify the start of the function name, followed by the function name;
2), behind the function name, with the beginning of the "@ @ YG" table that identifies a parameter, followed by the parameter list;
3), the parameter list to code said:
X - void,
D - char,
E - unsigned char,
F - short,
H - int,
I, unsigned int,
J - long,
K - unsigned long,
M - float,
N - double,
_N bool,
PA - said a pointer, the back of the code that pointer type, if the same type of pointer appears in a row, to "0" instead of a "0" is for a repeat;
4), the parameter list of the first item for the function return value type, followed by subsequent parameter data types, pointer id before referred to in the data type;
5), the parameter table to identify the name "@ Z" after the end of this function has no parameters, ends with a "Z" logo,
The format for? "" Functionname @ @ YG "or" * * * * * @ Z? Functionname @ @ YG * XZ ", for example,
Int Test1 (char * var1, unsigned long) -- -- -- -- -- "? Test1 @ @ YGHPADK @ Z
"Void Test2 () -- -- -- -- -- "? Test2 @ @ YGXXZ
"
__cdecl calling convention:
Rules ditto below _stdcall calling convention, is just the beginning of the argument list identifying the above "@ @ YG" into "@ @ YA,"
__fastcall calling convention:
Rules ditto below _stdcall calling convention, is just the beginning of the argument list identifying the above "@ @ YG" into "@ @ YI,"
Vc + + province short of about the function, the statement is "__cedcl" will call can only be C/C + +.

CodePudding user response:

Function overloading function name but same parameter type is not the same as the return type
  • Related