对'WinMain&#39的注释不一致。[英] Inconsistent annotation for 'WinMain'

本文是小编为大家收集整理的关于对'WinMain&#39的注释不一致。的处理/解决方法,可以参考本文帮助大家快速定位并解决问题,中文翻译不准确的可切换到English标签页查看源文。

问题描述

本文来自:IT宝库(https://www.itbaoku.cn)

我试图使我的代码尽可能完美,并且已经清理了所有错误和(其他)警告.我剩下这两个:

Warning C28253  Inconsistent annotation for 'WinMain': _Param_(2) has 'SAL_null(__no)' on this instance.
Warning C28252  Inconsistent annotation for 'WinMain': _Param_(2) has 'SAL_null(__maybe)' on the prior instance.

这是我的Winmain功能

int CALLBACK WinMain( _In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow );

为什么我的第二个paramater HINSTANCE hPrevInstance尽管直接从MSDN撕裂,但没有正确注释.

推荐答案

这是因为hPrevInstance参数实际上具有_In_opt_注释,而不是_In_.

本文地址:https://www.itbaoku.cn/post/2360174.html

问题描述

I'm trying to get my code as perfect as possible, and I've cleaned up all errors and (other) warnings. I'm left with these two:

Warning C28253  Inconsistent annotation for 'WinMain': _Param_(2) has 'SAL_null(__no)' on this instance.
Warning C28252  Inconsistent annotation for 'WinMain': _Param_(2) has 'SAL_null(__maybe)' on the prior instance.

Here is my WinMain function

int CALLBACK WinMain( _In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In_ LPSTR lpCmdLine, _In_ int nCmdShow );

Why is my second paramater HINSTANCE hPrevInstance not annotated correctly despite it being ripped straight from MSDN with the _In_ info?

推荐答案

It is because the hPrevInstance argument actually has the _In_opt_ annotation rather than just _In_.