最多的代码错误

Posted likemao

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了最多的代码错误相关的知识,希望对你有一定的参考价值。

1.pvs_studio_V730

msg="Not all members of a class are initialized inside the constructor. Consider inspecting: createdDateTime, modifiedDateTime."

技术分享图片

2.pvs_studio_V595

msg="The ‘browser‘ pointer was utilized before it was verified against nullptr. Check lines: 280, 283."

技术分享图片

3.pvs_studio_V721

msg="The VARIANT_BOOL type is utilized incorrectly. The true value (VARIANT_TRUE) is defined as -1. Check: ((& isPreview)->boolVal) = m_isPreview."

技术分享图片

4.pvs_studio_V811

msg="Decreased performance. Excessive type casting: string -> char * -> string. Consider inspecting first argument of the function fileExists."

技术分享图片

5.pvs_studio_V547

msg="Expression ‘j >= 0‘ is always true. Unsigned type value is always >= 0."

技术分享图片

6.pvs_studio_V716

msg="Suspicious type conversion in assign expression: ‘BOOL = HRESULT‘."

技术分享图片

7.pvs_studio_V745

msg="A ‘wchar_t *‘ type string is incorrectly converted to ‘BSTR‘ type string. Consider using ‘SysAllocString‘ function."

技术分享图片

8.pvs_studio_V746

msg="Type slicing. An exception should be caught by reference rather than by value."

技术分享图片

9.pvs_studio_V724

msg="Converting type ‘int‘ to type ‘VARIANT_BOOL‘ can lead to a loss of high-order bits. Non-zero value can become ‘FALSE‘."

技术分享图片

10.pvs_studio_V814

msg="Decreased performance. Calls to the ‘wcslen‘ function have being made multiple times when a condition for the loop‘s continuation was calculated."

技术分享图片

11.pvs_studio_V575

msg="The null pointer is passed into ‘memcpy‘ function. Inspect the second argument."

技术分享图片

12.pvs_studio_V501

msg="There are identical sub-expressions to the left and to the right of the ‘!=‘ operator: m_fitMode != m_fitMode"

技术分享图片

13.pvs_studio_V512

msg="A call of the ‘memset‘ function will lead to underflow of the buffer ‘lpszHeadInfo‘."

技术分享图片

14.pvs_studio_V523

msg="The ‘then‘ statement is equivalent to the ‘else‘ statement."

技术分享图片

15.pvs_studio_V567

msg="Undefined behavior. The ‘m_pixmapIndex‘ variable is modified while being used twice between sequence points."

技术分享图片

16.pvs_studio_V570

msg="The ‘height‘ variable is assigned to itself."

技术分享图片

17.pvs_studio_V576

msg="Incorrect format. Consider checking the third actual argument of the ‘wsprintfW‘ function. To print the value of pointer the ‘%p‘ should be used."

技术分享图片

18.pvs_studio_V704

msg=‘this == nullptr‘ expression should be avoided - this expression is always false on newer compilers, because ‘this‘ pointer can never be NULL.

技术分享图片

19.pvs_studio_V763

msg="Parameter ‘handle‘ is always rewritten in function body before being used."

技术分享图片

20.pvs_studio_V510

msg="The ‘Format‘ function is not expected to receive class-type variable as second actual argument."

技术分享图片

21.pvs_studio_V522

msg="Dereferencing of the null pointer ‘pTask‘ might take place. Check the logical condition."

技术分享图片

22.pvs_studio_V599

msg="The destructor was not declared as a virtual one, although the ‘KAutoSaveItem‘ class contains virtual functions."

技术分享图片

23.pvs_studio_V607

msg="Ownerless expression ‘Download_Fail‘.

技术分享图片

24.pvs_studio_V672

msg="There is probably no need in creating the new ‘context‘ variable here. One of the function‘s arguments possesses the same name and this argument is a reference.

技术分享图片

25.pvs_studio_V517

msg="The use of ‘if (A) {...} else if (A) {...}‘ pattern was detected. There is a probability of logical error presence. Check lines: 47, 59."

技术分享图片

26.pvs_studio_V561

msg="It‘s probably better to assign value to ‘hr‘ variable than to declare it anew. Previous declaration: kolfontqhbcommand.cpp, line 343."

技术分享图片

27.pvs_studio_V571

msg="Recurring check. The ‘if (!layout)‘ condition was already verified in line 1032

技术分享图片

28.pvs_studio_V611

msg="The memory was allocated using ‘new T[]‘ operator but was released using the ‘delete‘ operator. Consider inspecting this code. It‘s probably better to use ‘delete [] buffer;‘.

技术分享图片

 

29.pvs_studio_V674

msg="The literal ‘10.5‘ of ‘double‘ type is being implicitly cast to ‘int‘ type while calling the ‘setPointSize‘ function. Inspect the first argument."

技术分享图片

30.pvs_studio_V541

msg="It is dangerous to print the string ‘strParam‘ into itself."

技术分享图片

31.pvs_studio_V542

msg="Consider inspecting an odd type cast: ‘unsigned short‘ to ‘wchar_t *‘."

技术分享图片

 

32.pvs_studio_V629

msg="Consider inspecting the ‘0x1 << (- * pStateBase[curState])‘ expression. Bit shifting of the 32-bit value with a subsequent expansion to the 64-bit type."

技术分享图片

33.pvs_studio_V521

msg="Such expressions using the ‘,‘ operator are dangerous. Make sure the expression is correct."

技术分享图片

34.pvs_studio_V554

msg="Incorrect use of unique_ptr. The memory allocated with ‘new []‘ will be cleaned using ‘delete‘."

技术分享图片

35.pvs_studio_V734

msg="An excessive check. Examine the conditions containing search for the substrings "*.dot" and "*.dotm"."

技术分享图片

36.pvs_studio_V528

msg="It is odd that pointer to ‘wchar_t‘ type is compared with the L‘‘ value. Probably meant: *pPath == L‘‘."

技术分享图片

37.pvs_studio_V590

msg="Consider inspecting the ‘lResult == 0L && lResult != 234L‘ expression. The expression is excessive or contains a misprint."

技术分享图片

38.pvs_studio_V617

msg="Consider inspecting the condition. The ‘SizeY_FitContent‘ argument of the ‘|‘ bitwise operation contains a non-zero value."

技术分享图片

39.pvs_studio_V712

msg="Be advised that compiler may delete this cycle or make it infinity. Use volatile variable(s) or synchronization primitives to avoid this."

技术分享图片

40.pvs_studio_V502

msg="Perhaps the ‘?:‘ operator works in a different way than it was expected. The ‘?:‘ operator has a lower priority than the ‘==‘ operator."

技术分享图片

41.pvs_studio_V557

msg="Array overrun is possible. The ‘16‘ index is pointing beyond array bound."

技术分享图片

42.pvs_studio_V625

msg="Consider inspecting the ‘for‘ operator. Initial and final values of the iterator are the same."

技术分享图片

43.pvs_studio_V682

msg="Suspicious literal is present: ‘/0‘. It is possible that a backslash should be used here instead: ‘‘."

技术分享图片

44.pvs_studio_V766

msg="An item with the same key ‘L"secretKey"‘ has already been added."

技术分享图片

45.pvs_studio_V767

msg="Suspicious access to element of ‘fileList‘ array by a constant index inside a loop.

技术分享图片

以上是关于最多的代码错误的主要内容,如果未能解决你的问题,请参考以下文章

找出哪个对象/数组使用最多的堆栈内存

3192. 出现次数最多的数 13年12月CSP

第一次写代码总结

Laravel 获取记录最多的前 5 个 ID

Java初学者容易犯的代码错误

Android NDK 定位出错代码位置