Windows SDK 示例中缺少 WinMain() 参数
在 Windows SDK 附带的示例之一(CreateProcessVerb 示例)中,WinMain 代码如下:
int APIENTRY
wWinMain (HINSTANCE, HINSTANCE, PWSTR pszCmdLine, int)
{
..
请注意,实际上只指定了第三个参数,其余参数已被忽略。这怎么可能?为什么 C++ 编译器不会对此感到不安?是否引入默认值?如果是,通过什么机制引入?
谢谢-
托德
In one of the samples that come w/ Windows SDK (the CreateProcessVerb sample), the WinMain code is as follows:
int APIENTRY
wWinMain (HINSTANCE, HINSTANCE, PWSTR pszCmdLine, int)
{
..
Note that only the 3rd argument is actually specified, the rest have been ignored. How is this possible? Why does the C++ compiler not get upset w/ this? Are default values being pulled in, and if so, through what mechanism?
Thanks -
Todd
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 C++ 中,您不必为不使用的参数命名。在 C 中,您只能使用原型来做到这一点:
在 C++ 中,这也适用于定义:
In C++ you don't have to give names to the parameters you don't use. In C you can do that only with prototypes:
In C++ this also works in definitions: