C/C++相关备忘

C/C++相关备忘

Microsoft VC/C++

类型含义
LPCTSTR表示const字符串,L表示long,P表示pointer,C表示const,
T表示_T(win32中有一个_T宏,unicode表示w,ansi表示),
根据系统是否使用unicode编码通过typedef定义
HBRUSHHBRUSH表示指向一个 包含一个int型的结构体的 指针
通过宏DECLARE_HANDLE(HBRUSH);定义
展开为#define DECLARE_HANDLE(name) struct name##__ {int unused;};
typedef struct name##__ *name
即定义typedef struct HBRUSH__ * HBRUSH,HBRUSH__为包含一个int型数据的结构体
LRESULTLRESULT表示long类型;
typedef LONG_PTR LRESULT;
typedef _W64 long LONG_PTR, *PLONG_PTR;
The _W64 annotation is a note to the Miscrosoft compiler that when compiling for a 64-bit target,
the variable should be 64 bits wide instead of the usual 32, since on 64-bit platforms,
pointers are 64 bits, but unsigned ints are usually still 32 bits.
This ensures that sizeof(UINT_PTR) >= sizeof(void*) for all target platforms.
_W64用于提示Microsoft编译器,当编译64位目标时,该变量需要是64位的,而不是常规的32位
__stdcall该关键字修饰的函数表示调用的参数从右到左由堆栈传递,
堆栈由被调用者在函数返回前清理
__fastcall表示前面的参数先由ecx,edx寄存器传递
主要见于Microsoft Visual C/C++,
GNU C/C++使用另一种修饰方式atrribute\__((stdcall))
CALLBACK根据不同的宏定义不同的函数参数传递方式,如#define CALLBACK __stdcall
HWND与HBRUSH定义相同
WPARAMunsigned int 类型
typedef UINT_PTR WPARAM;
typedef _W64 unsigned int UINT_PTR, *PUINT_PTR;
LPARAMlong类型
typedef LONG_PTR LPARAM;
typedef _W64 long LONG_PTR, *PLONG_PTR;

GNU C/C++

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值