[问题] 为什么函式可以不用括号?(已解决)

楼主: Ommm5566 (56天團)   2016-07-01 20:31:07
开发平台(Platform): (Ex: VC++, GCC, Linux, ...)
VC++
额外使用到的函数库(Library Used): (Ex: OpenGL, ...)
window.h
问题(Question):
为什么第6行宣告WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
但是第32行却可以wc.pfnWndProc = WndProc;
正常函式使用至少也要有小括号吧 例如至少 WndProc();
喂入的资料(Input):

预期的正确结果(Expected Output):
错误结果(Wrong Output):

程式码(Code):(请善用置底文网页, 记得排版)
http://www.winprog.org/tutorial/simple_window.html
作者: Schottky (顺风相送)   2016-07-01 20:32:00
pfnWndProc 是 function pointer不是把 WndProc() 执行后的传回值放进 pfnWndProc
作者: vaio8937 (直把杭州当汴州)   2016-07-01 21:07:00
他不是在呼叫函式他只是把名称当作指标传递

Links booklink

Contact Us: admin [ a t ] ucptt.com