码迷,mamicode.com
首页 > 编程语言 > 详细

C++ 修饰名的格式探究

时间:2014-12-23 19:22:07      阅读:264      评论:0      收藏:0      [点我收藏+]

标签:

以下结果是由VS2010里面测试得出:

------------------------------------------------------------------

 

/*
函数名、类名、名称空间、@@、函数访问级别、调用约定、返回类型、参数类型、有无参数(@Z、XZ)
函数名:	?函数名
类名:	@类名
名称空间:@名称空间名
函数访问级别:
純函数是Y,静态类方法public,protected,private依次是S,K,C
非静态类方法public,protected,private依次是QA,IA,AA
调用约定:__cdecl 是 A , __stdcall 是 G
对于返回类型与参数类型:
void,char,signed char,unsigned char,short,unsigned short,
int,unsigned int,long,unsigned long,float,double,long double,
long long,unsigned long
依次对应:X, D, C, E, F, G, H, I, J, K, M, N, O, _J, _K
有无参数:有参数@Z、无参数XZ
-------------------------------------------------------
int	foo(void);			?foo@@YAHXZ
short foo(void);			?foo@@YAFXZ
short foo(int, int);				?foo@@YAFHH@Z
short __cdecl foo(int, int);		?foo@@YAFHH@Z
short __stdcall foo(int, int);		?foo@@YGFHH@Z
short __stdcall muyou::foo(int,int)	?foo@muyou@@YGFHH@Z
public: static short __stdcall muyou::a::foo(int,int)		?foo@a@muyou@@SGFHH@Z
protected: static short __stdcall muyou::a::foo(int,int)	?foo@a@muyou@@KGFHH@Z
private: static short __stdcall muyou::a::foo(int,int)	?foo@a@muyou@@CGFHH@Z
private: short __stdcall muyou::a::foo(int,int)			?foo@a@muyou@@AAGFHH@Z
protected: short __stdcall muyou::a::foo(int,int)			?foo@a@muyou@@IAGFHH@Z
public: short __stdcall muyou::a::foo(int,int)			?foo@a@muyou@@QAGFHH@Z
-------------------------------------------
void foo();				?foo@@YAXXZ
void foo(void);			?foo@@YAXXZ
void foo(char);			?foo@@YAXD@Z
void foo(signed char);		?foo@@YAXC@Z
void foo(unsigned char);	?foo@@YAXE@Z
void foo(short);			?foo@@YAXF@Z
void foo(signed short);	?foo@@YAXF@Z
void foo(unsigned short);	?foo@@YAXG@Z
void foo(int);			?foo@@YAXH@Z
void foo(signed int);		?foo@@YAXH@Z
void foo(unsigned int);	?foo@@YAXI@Z
void foo(long);			?foo@@YAXJ@Z
void foo(signed long);		?foo@@YAXJ@Z
void foo(unsigned long);	?foo@@YAXK@Z
void foo(float);			?foo@@YAXM@Z
void foo(double);			?foo@@YAXN@Z
void foo(long double);		?foo@@YAXO@Z
void foo(long long);		?foo@@YAX_J@Z
void foo(signed long long);?foo@@YAX_J@Z
void foo(unsigned long long);?foo@@YAX_K@Z
*/
namespace muyou{
	class a
	{
	public:
		short __stdcall foo(int, int);
	public:
		void vf(){foo(1, 1);}
	};
}
using muyou::a;
int main(void)
{
	a oa;
	oa.vf();

	return 0;
}

 

  

 

C++ 修饰名的格式探究

标签:

原文地址:http://www.cnblogs.com/xxNote/p/4180652.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!