Windows SDK 示例中缺少 WinMain() 参数

发布于 2024-10-05 21:57:33 字数 269 浏览 0 评论 0原文

在 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

兔小萌 2024-10-12 21:57:33

在 C++ 中,您不必为不使用的参数命名。在 C 中,您只能使用原型来做到这一点:

void function(int, char *, double, long);

在 C++ 中,这也适用于定义:

void function(int, char *, double, long)
{
    // ...
}

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:

void function(int, char *, double, long);

In C++ this also works in definitions:

void function(int, char *, double, long)
{
    // ...
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文