C 函式前加巨集表示的意思

2021-05-09 04:48:03 字數 1149 閱讀 1515

lresult callback wndproc(hwnd hwnd, uint message, wparam wparam, lparam lparam)

相信大家都知道這個函式,但分析似乎比平常的函式定義多了callback。

現在分析如下:

lresult為返回值,實際上是long

callback為巨集,#define callback    __stdcall。是定義一種呼叫約定。

作用是:

pushes parameters on the stack, in reverse order (right to left)

意思:將引數按反序(從右到左)壓入堆疊中。

其他巨集:

calling conventions

the following calling conventions are supported by the visual c/c++ compiler.

keyword  stack cleanup  parameter passing 

__cdecl

caller

pushes parameters on the stack, in reverse order (right to left)

__clrcall

n/a

load parameters onto clr expression stack in order (left to right).

__stdcall

callee

pushes parameters on the stack, in reverse order (right to left)

__fastcall

callee

stored in registers, then pushed on stack

__thiscall

callee

pushed on stack; this pointer stored in ecx

calling convention for callback functions.

this type is declared in windef.h as follows:

#define callback __stdcall

C 函式前加 的作用

c 中函式前加 是表示此函式是析構函式。析構函式介紹 1.析構函式 destructor 與建構函式相反,當物件脫離其作用域時 例如物件所在的函式已呼叫完畢 系統自動執行析構函式。析構函式往往用來做 清理善後 的工作 例如在建立物件時用new開闢了一片記憶體空間,應在退出前在析構函式中用delete...

前的數字表示什麼意思

include include int main return 0 這是乙個年利率為5 的儲蓄賬號中存入1000美元,儲存10年計算本息合金的程式。其中 05表示5 後面的21定義了列印這個變數所占用的域寬,域寬取21表示列印這個變數需要占用21個字元的位置,如果最終顯示出來的數值個數小於域寬則資料...

在php中的變數和函式名前加 符號的意思

在php中的變數和函式名前加 符號的意思 在php中 符號即傳的是變數的引用而不是拷貝,引用意味著用不同的名字訪問同乙個變數內容。這並不像 c 的指標,它們是符號表別名。注意在 php 中,變數名和變數內容是不一樣的,因此同樣的內容可以有不同的名字。最接近的比喻是 unix 的檔名和檔案本身 變數名...