Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

Code Analysis for C/C++ Warnings

This section lists C/C++ Code Analysis warnings. For information about Code Analysis, see /analyze (Code Analysis) and Quick Start: Code Analysis for C/C++.

Warning Number

Description

C1250

warning C1250: Unable to load plug-in

C1252

warning C1252: Circular or missing dependency between plugins: requires GUID

C1253

warning C1253: Unable to load model file

C1254

warning C1254: Plugin version mismatch : version doesn't match the version of the PREfast driver

C1255

warning C1255: PCH data for plugin has incorrect length

C1256

warning C1256: PCH must be both written and read

C1257

warning C1257: Plugin Initialization Failure

C6001

warning C6001: using uninitialized memory <variable>

C6011

warning C6011: dereferencing NULL pointer <name>

C6029

warning C6029: possible buffer overrun in call to <function>: use of unchecked value

C6031

warning C6031: return value ignored: <function> could return unexpected value

C6053

warning C6053: call to <function> may not zero-terminate string <variable>

C6054

warning C6054: string <variable> may not be zero-terminated

C6059

warning C6059: Incorrect length parameter in call to <function>. Pass the number of remaining characters, not the buffer size of <variable>

C6063

warning C6063: missing string argument to <function> corresponding to conversion specifier <number>

C6064

warning C6064: missing integer argument to <function> corresponding to conversion specifier <number>

C6066

warning C6066: non-pointer passed as parameter <number> when pointer is required in call to <function>

C6067

warning C6067: parameter <number> in call to <function> must be the address of the string

C6101

warning C6101: Returning uninitialized memory

C6200

warning C6200: index <name> is out of valid index range <min> to <max> for non-stack buffer <variable>

C6201

warning C6201: buffer overrun for <variable>, which is possibly stack allocated: index <name> is out of valid index range <min> to <max>

C6211

warning C6211: Leaking memory <pointer> due to an exception. Consider using a local catch block to clean up memory

C6214

warning C6214: cast between semantically different integer types: HRESULT to a Boolean type

C6215

warning C6215: cast between semantically different integer types: a Boolean type to HRESULT

C6216

warning C6216: compiler-inserted cast between semantically different integral types: a Boolean type to HRESULT

C6217

warning C6217: Implicit cast between semantically different integer types: testing HRESULT with 'not'. Consider using SUCCEEDED or FAILED macro instead

C6219

warning C6219: Implicit cast between semantically different integer types: comparing HRESULT to 1 or TRUE. Consider using SUCCEEDED or FAILED macro instead

C6220

warning C6220 - Implicit cast between semantically different integer types: comparing HRESULT to -1. Consider using SUCCEEDED or FAILED macro instead

C6221

warning C6221: Implicit cast between semantically different integer types: comparing HRESULT to an integer. Consider using SUCCEEDED or FAILED macros instead

C6225

warning C6225: Implicit cast between semantically different integer types: assigning 1 or TRUE to HRESULT. Consider using S_FALSE instead

C6226

warning C6226: Implicit cast between semantically different integer types: assigning -1 to HRESULT. Consider using E_FAIL instead

C6230

warning C6230: implicit cast between semantically different integer types: using HRESULT in a Boolean context

C6235

warning C6235: (<non-zero constant> || <expression>) is always a non-zero constant

C6236

warning C6236: (<expression> || <non-zero constant>) is always a non-zero constant

C6237

warning C6237: (<zero> && <expression>) is always zero. <expression> is never evaluated and may have side effects

C6239

warning C6239: (<non-zero constant> && <expression>) always evaluates to the result of <expression>. Did you intend to use the bitwise-and operator?

C6240

warning C6240: (<expression> && <non-zero constant>) always evaluates to the result of <expression>. Did you intend to use the bitwise-and operator?

C6242

warning C6242: A jump out of this try-block forces local unwind. Incurs severe performance penalty

C6244

warning C6244: local declaration of <variable> hides previous declaration at <line> of <file>

C6246

warning C6246: Local declaration of <variable> hides declaration of same name in outer scope. Additional Information: See previous declaration at <location>.

C6248

warning C6248: setting a SECURITY_DESCRIPTOR’s DACL to NULL will result in an unprotected object

C6250

warning C6250: Calling <function> VirtualFree without the MEM_RELEASE flag may free memory but not address descriptors (VADs); results in address space leaks

C6255

warning C6255: _alloca indicates failure by raising a stack overflow exception. Consider using _alloca_s instead

C6258

warning C6258: using TerminateThread does not allow proper thread clean up

C6259

warning C6259: labeled code is unreachable: (<expression> & <constant>) in switch-expr cannot evaluate to <case-label>

C6260

warning C6260: sizeof * sizeof is almost always wrong, did you intend to use a character count or a byte count?

C6262

warning C6262: Function uses <constant> bytes of stack: exceeds /analyze:stacksize<constant>. Consider moving some data to heap

C6263

warning C6263: using _alloca in a loop; this can quickly overflow stack

C6268

warning C6268: Incorrect order of operations: (<TYPE1>)(<TYPE2>)x + y. Possible missing parentheses in (<TYPE1>)((<TYPE2>)x + y)

C6269

warning C6269: possible incorrect order of operations: dereference ignored

C6270

warning C6270: missing float argument to <function>: add a float argument corresponding to conversion specifier <number>

C6271

warning C6271: extra argument passed to <function>: parameter <number> is not used by the format string

C6272

warning C6272: non-float passed as argument <number> when float is required in call to <function>

C6273

warning 6273 - non-integer passed as parameter <number> when integer is required in call to <function>: if a pointer value is being passed, %p should be used

C6274

warning C6274: non-character passed as parameter <number> when character is required in call to <function>

C6276

warning C6276: Cast between semantically different string types: char* to wchar_t*. Use of invalid string can lead to undefined behavior

C6277

warning C6277: NULL application name with an unquoted path in call to <function>: results in a security vulnerability if the path contains spaces

C6278

warning C6278: <variable> is allocated with array new [], but deleted with scalar delete. Destructors will not be called

C6279

warning C6279: <variable> is allocated with scalar new, deleted with array delete []

C6280

warning C6280: <variable> is allocated with <function>, but deleted with <function>

C6281

warning 6281 - incorrect order of operations: relational operators have higher precedence than bitwise operators

C6282

warning C6282: Incorrect operator: assignment of constant in Boolean context. Consider using '==' instead

C6283

warning C6283: <variable> is allocated with array new [], but deleted with scalar delete

C6284

warning C6284: object passed as parameter '%d' when string is required in call to <function>.

C6285

warning C6285: (<non-zero constant> || <non-zero constant>) is always a non-zero constant. Did you intend to use the bitwise-and operator?

C6286

warning C6286: (<non-zero constant> || <expression>) is always a non-zero constant. <expression> is never evaluated and may have side effects

C6287

warning C6287: redundant code: the left and right sub-expressions are identical

C6288

warning C6288: Incorrect operator: mutual inclusion over && is always zero. Did you intent to use || instead?

C6289

warning C6289: Incorrect operator: mutual exclusion over || is always a non-zero constant. Did you intend to use && instead?

C6290

warning C6290: Bitwise operation on logical result: ! has higher precedence than &. Use && or (!(x & y)) instead

C6291

warning C6291: Bitwise operation on logical result: ! has higher precedence than |. Use || or (!(x | y)) instead

C6292

warning C6292: ill-defined for-loop: counts up from maximum

C6293

warning C6293: Ill-defined for-loop: counts down from minimum

C6294

warning C6294: Ill-defined for-loop: initial condition does not satisfy test. Loop body not executed

C6295

warning C6295: Ill-defined for-loop: <variable> values are of the range "min" to "max". Loop executed indefinitely

C6296

warning C6296: Ill-defined for-loop: Loop body only executed once

C6297

warning C6297: Arithmetic overflow: 32-bit value is shifted, then cast to 64-bit value. Result may not be an expected value

C6298

warning C6298: using a read-only string <pointer> as a writable string argument: this will attempt to write into static read-only memory and cause random crashes

C6299

warning C6299: explicitly comparing a bit field to a Boolean type will yield unexpected results

C6302

warning C6302: format string mismatch: character string passed as parameter <number> when wide character string is required in call to <function>s

C6303

warning C6303: format string mismatch: wide character string passed as parameter <number> when character string is required in call to <function>

C6305

warning C6305: potential mismatch between sizeof and countof quantities

C6306

warning C6306: incorrect call to <function>: consider using <function> which accepts a va_list as an argument

C6308

warning C6308: 'realloc' may return null pointer: assigning a null pointer to <variable>, which is passed as an argument to 'realloc', will cause the original memory block to be leaked

C6310

warning C6310: illegal constant in exception filter can cause unexpected behavior

C6312

warning C6312: Possible infinite loop: use of the constant EXCEPTION_CONTINUE_EXECUTION in the exception-filter expression of a try-except

C6313

warning C6313: Incorrect operator: Zero-valued flag cannot be tested with bitwise-and. Use an equality test to look for zero-valued flags

C6314

warning C6314: Incorrect order of operations: bitwise-or has higher precedence than the conditional-expression operator. Add parentheses to clarify intent

C6315

warning C6315: Incorrect order of operations: bitwise-and has higher precedence than bitwise-or. Add parentheses to clarify intent

C6316

warning C6316: Incorrect operator: tested expression is constant and non-zero. Use bitwise-and to determine whether bits are set

C6317

warning C6317: incorrect operator: logical-not (!) is not interchangeable with ones-complement (~)

C6318

warning C6318: Ill-defined __try/__except: use of the constant EXCEPTION_CONTINUE_SEARCH or another constant that evaluates to zero in the exception-filter expression. The code in the exception handler block is not executed

C6319

warning C6319: use of the comma-operator in a tested expression causes the left argument to be ignored when it has no side-effects

C6320

warning C6320: exception-filter expression is the constant EXCEPTION_EXECUTE_HANDLER. This may mask exceptions that were not intended to be handled

C6322

warning C6322: empty _except block

C6323

warning 6323 - use of arithmetic operator on Boolean type(s)

C6324

warning C6324: potential incorrect use of <function1>: Did you intend to use <function2>?

C6326

warning C6326: potential comparison of a constant with another constant

C6328

warning C6328:<type> passed as parameter <number> when <type> is required in call to <function>

C6330

warning C6330: Incorrect type passed as parameter in call to function

C6331

warning C6331: Invalid parameter: passing MEM_RELEASE and MEM_DECOMMIT in conjunction to <function> is not allowed. This results in the failure of this call

C6332

warning C6332: Invalid parameter: passing zero as the dwFreeType parameter to <function> is not allowed. This results in the failure of this call

C6333

warning C6333: Invalid parameter: passing MEM_RELEASE and a non-zero dwSize parameter to <function> is not allowed. This results in the failure of this call

C6334

warning C6334: sizeof operator applied to an expression with an operator may yield unexpected results

C6335

warning C6335: leaking process information handle <handlename>

C6336

warning C6336: arithmetic operator has precedence over question operator, use parentheses to clarify intent

C6340

warning C6340: Incorrect type passed as parameter in call to function

C6381

warning C6381: Shutdown API <function> requires a valid dwReason or lpMessage

C6383

warning C6383: buffer overrun due to conversion of an element count into a byte count: an element count is expected for parameter <number> in call to <function>

C6384

warning C6384: dividing sizeof a pointer by another value

C6385

warning C6385: invalid data: accessing <buffer name>, the readable size is <size1> bytes, but <size2> bytes may be read: Lines: x, y

C6386

warning C6386: buffer overrun: accessing <buffer name>, the writable size is <size1> bytes, but <size2> bytes may be written: Lines: x, y

C6387

warning C6387: <argument> may be <value>: this does not adhere to the specification for the function <function name>: Lines: x, y

C6388

warning C6388: <argument> may not be <value>: this does not adhere to the specification for the function <function name>: Lines: x, y

C6400

warning C6400: Using <function name> to perform a case-insensitive compare to constant string <string name>. Yields unexpected results in non-English locales

C6401

warning C6401: Using <function name> in a default locale to perform a case-insensitive compare to constant string < string name>. Yields unexpected results in non-English locales

C6500

warning C6500: invalid annotation: value for <name> property is invalid

C6501

warning C6501: annotation conflict: <name> property conflicts with previously specified property

C6503

warning C6503: annotation conflict: references may not be marked Null=Yes or Null=Maybe

C6504

warning C6504: invalid annotation: property may only be used on values of pointer, pointer-to-member, or array type

C6505

warning C6505: invalid annotation: MustCheck property may not be used on values of void type

C6506

warning C6506: invalid annotation: <name> property may only be used on values of pointer or array types

C6508

warning C6508: invalid annotation: write access is not allowed on const values

C6509

warning C6509: invalid annotation: 'return' cannot be referenced from a precondition

C6510

warning C6510: invalid annotation: NullTerminated property may only be used on values of pointer or array type

C6511

warning C6511: invalid annotation: MustCheck property must be Yes or No

C6513

warning C6513: invalid annotation: ElementSizeConst requires additional size properties

C6514

warning C6514: invalid annotation: value of the <name> property exceeds the size of the array

C6515

warning C6515 - invalid annotation: <name> property may only be used on values of pointer type

C6516

warning C6516: invalid annotation: no properties specified for <name> attribute

C6517

warning C6517: annotation conflict: ValidElementsConst and ValidBytesConst may not be specified on the buffers that are not readable

C6518

warning C6518: annotation conflict: WriteableElementsConst and WriteableBytesConst may not be specified on buffers that are not writable

C6522

warning C6522: invalid size specification: expression must be of integral type

C6525

warning C6525: invalid size specification: property value may not be valid

<PAVE OVER>C6526

warning C6526 - invalid size specification: expression must be of array or pointer type

C6527

warning C6527: Invalid annotation: NeedsRelease property may not be used on values of void type

C6530

warning 6530: unrecognized format string style <name>

C6540

warning C6540: The use of attribute annotations on this function will invalidate all of its existing __declspec annotations

C6551

warning C6551: Invalid size specification: expression not parsable

C6552

warning C6552: Invalid Deref= or Notref=: expression not parsable

C6701

warning C6701: The value is not a valid Yes/No/Maybe value: <string>

C6702

warning C6702: The value is not a string value: <string>

C6703

warning C6703: The value is not a number: <string>

C6704

warning C6704: Unexpected Annotation Expression Error: <annotation> [<why>]

C6705

warning C6705: Annotation error expected <expected_number> arguments for annotation <parameter> found <actual_number>.

C6706

warning C6706: Unexpected Annotation Error for annotation <annotation>: <why>

C6707

warning C6707: Unexpected Model Error: <why>

C26100

warning C26100: Race condition. Variable <var> should be protected by lock <lock>.

C26101

warning C26101: Failing to use interlocked operation properly for variable <var>.

C26105

warning C26105: Lock order violation. Acquiring lock <lock> with level <level> causes order inversion.

C26110

warning C26110: Caller failing to hold lock <lock> before calling function <func>.

C26111

warning C26111: Caller failing to release lock <lock> before calling function <func>.

C26112

warning C26112: Caller cannot hold any lock before calling <func>.

C26115

warning C26115: Failing to release lock <lock> in function <func>.

C26116

warning C26116: Failing to acquire or to hold <lock> in <func>.

C26117

warning C26117: Releasing unheld lock <lock> in function <func>.

C26130

warning C26130: Missing annotation _Requires_lock_held_(<lock>) or _No_competing_thread_ at function <func>. Otherwise it could be a race condition. Variable <var> should be protected by lock <lock>.

C26135

warning C26135: Missing annotation <annotation> at function <func>.

C26140

warning C26140: Concurrency SAL annotation error.

C26160

warning C26160: Caller possibly failing to hold lock <lock> before calling function <func>.

C26165

warning C26165: Possibly failing to release lock <lock> in function <func>.

C26166

warning C26166: Possibly failing to acquire or to hold lock <lock> in function <func>.

C26167

warning C26167: Possibly releasing unheld lock <lock> in function <func>.

C28020

warning C28020: The expression <expr> is not true at this call

C28021

warning C28021: The parameter <param> being annotated with <anno> must be a pointer

C28022

warning C28022: The function class(es) <classlist1> on this function do not match the function class(es) <classlist2> on the typedef used to define it.

C28023

warning C28023: The function being assigned or passed should have a _Function_class_ annotation for at least one of the class(es) in: <classlist>

C28024

warning C28024: The function pointer being assigned to is annotated with the function class <class>, which is not contained in the function class(es) <classlist>.

C28039

warning C28039: The type of actual parameter <operand> should exactly match the type <typename>

C28103

warning C28103: Leaking resource

C28104

warning C28104: Resource that should have been acquired before function exit was not acquired

C28105

warning C28105: Leaking resource due to an exception

C28106

warning C28106: Variable already holds resource possibly causing leak

C28107

warning C28107: Resource must be held when calling function

C28108

warning C28108: Variable holds an unexpected resource

C28109

warning C28109: Variable cannot be held at the time function is called

C28112

warning C28112: A variable which is accessed via an Interlocked function must always be accessed via an Interlocked function

C28113

warning C28113: Accessing a local variable via an Interlocked function

C28125

warning C28125: The function must be called from within a try/except block

C28137

warning C28137: The variable argument should instead be a (literal) constant

C28138

warning C28138: The constant argument should instead be variable

C28159

warning C28159: Consider using another function instead.

C28160

warning C28160: Error annotation

C28163

warning C28163: The function should never be called from within a try/except block

C28164

warning C28164: The argument is being passed to a function that expects a pointer to an object (not a pointer to a pointer)

C28182

Dereferencing NULL pointer

C28183

warning C28183: The argument could be one value, and is a copy of the value found in the pointer

C28193

warning C28193: The variable holds a value that must be examined

C28194

warning C28194: The function was declared as aliasing the value in variable and exited without doing so

C28195

warning C28195: The function was declared as acquiring memory in a variable and exited without doing so

C28196

warning C28196: The requirement is not satisfied. (The expression does not evaluate to true.)

C28197

warning C28197: Possibly leaking memory

C28198

warning C28198: Possibly leaking memory due to an exception.

C28199

warning C28199: Using possibly uninitialized memory

C28202

warning C28202: Illegal reference to non-static member

C28203

warning C28203: Ambiguous reference to class member. Could be <name1> or <name2>

C28204

warning C28204: <function> : Only one of this overload and the one at <filename>(<line>) are annotated for <paramname>: both or neither must be annotated.

C28205

warning C28205: function> : _Success_ or _On_failure_ used in an illegal context: <why>

C28206

warning C28206: <expression> : left operand points to a struct, use ->

C28207

warning C28207: <expression>: left operand is a struct, use .

C28208

warning C28208: Function <function> was previously defined with a different parameter list at <file>(<line>). Some analysis tools will yield incorrect results

C28209

warning C28209: The declaration for symbol has a conflicting declaration

C28210

warning 28210: Annotations for the _On_failure_ context must not be in explicit pre context

C28211

warning C28211: Static context name expected for SAL_context

C28212

warning C28212: Pointer expression expected for annotation

C28213

warning C28213: The _Use_decl_annotations_ annotation must be used to reference, without modification, a prior declaration. <why>

C28214

warning C28214: Attribute parameter names must be p1...p9

C28215

warning C28215: The typefix cannot be applied to a parameter that already has a typefix

C28216

warning C28216: The _Check_return_ annotation only applies to post-conditions for the specific function parameter.

C28217

warning 28217: For function, the number of parameters to annotation does not match that found at file

C28218

warning C28218: For function parameter, the annotation's parameter does not match that found at file

C28219

warning C28119: Member of enumeration expected for annotation the parameter in the annotation

C28220

warning C28220: Integer expression expected for annotation the parameter in the annotation

C28221

warning C28221: String expression expected for the parameter in the annotation

C28222

warning 28222: _Yes_, _No_, or _Maybe_ expected for annotation

C28223

warning C28223: Did not find expected Token/identifier for annotation, parameter

C28224

warning C28224: Annotation requires parameters

C28225

warning C28225: Did not find the correct number of required parameters in annotation

C28226

warning C28226: Annotation cannot also be a PrimOp (in current declaration)

C28227

warning C28227: Annotation cannot also be a PrimOp (see prior declaration)

C28228

warning C28228: Annotation parameter: cannot use type in annotations

C28229

warning C28229: Annotation does not support parameters

C28230

warning C28230: The type of parameter has no member.

C28231

warning C28231: Annotation is only valid on array

C28232

warning C28232: _Pre_, _Post_, or _Deref_ not applied to any annotation

C28233

warning C28233: pre, post, or deref applied to a block

C28234

warning C28234: _At_ expression does not apply to current function

C28235

warning C28235: The function cannot stand alone as an annotation

C28236

warning C28236: The annotation cannot be used in an expression

C28237

warning C28237: The annotation on parameter is no longer supported

C28238

warning C28238: The annotation on parameter has more than one of value, stringValue, and longValue. Use paramn=xxx

C28239

warning 28239: The annotation on parameter has both value, stringValue, or longValue; and paramn=xxx. Use only paramn=xxx

C28240

warning 28240: The annotation on parameter has param2 but no param1

C28241

warning C28241: The annotation for function on parameter is not recognized

C28243

warning C28343: The annotation for function on parameter requires more dereferences than the actual type annotated allows

C28244

warning C28244: The annotation for function has an unparseable parameter/external annotation

C28245

warning C28245: The annotation for function annotates 'this' on a non-member-function

C28246

warning C28246: The annotation for function '<name>' - parameter '<parameter>' does not match the type of the parameter

C28250

warning C28250: Inconsistent annotation for function: the prior instance has an error.

C28251

warning C28251: Inconsistent annotation for function: this instance has an error

C28252

warning C28252: Inconsistent annotation for function: parameter has another annotation on this instance

C28253

warning C28253: Inconsistent annotation for function: parameter has another annotations on this instance

C28254

warning C28254: dynamic_cast<>() is not supported in annotations

C28262

warning C28262: A syntax error in the annotation was found in function <function> for annotation <name>

C28263

warning C28263: A syntax error in a conditional annotation was found for Intrinsic annotation

C28267

warning C28267: A syntax error in the annotations was found annotation <name> in the function <function>.

C28272

warning C28272: The annotation for function, parameter when examining is inconsistent with the function declaration

C28273

warning C28273: For function, the clues are inconsistent with the function declaration

C28275

warning C28275: The parameter to _Macro_value_ is null

C28278

warning C28278: Function name appears with no prototype in scope.

C28279

warning C28279: For symbol, a 'begin' was found without a matching 'end'

C28280

warning C28280: For symbol, an 'end' was found without a matching 'begin'

C28282

warning C28282: Format Strings must be in preconditions

C28283

warning C28283: For symbol, the specified size specification is not yet supported

C28284

warning C28284: For symbol, Predicates are currently not supported for non-function symbols

C28285

warning C28285: For function, syntax error in parameter

C28286

warning C28286: For function, syntax error near the end

C28287

warning C28287: For function, syntax Error in _At_() annotation (unrecognized parameter name)

C28288

warning C28288: For function, syntax Error in _At_() annotation (invalid parameter name)

C28289

warning C28289: For function: ReadableTo or WritableTo did not have a limit-spec as a parameter

C28290

warning C28290: the annotation for function contains more Externals than the actual number of parameters

C28291

warning C28291: post null/notnull at deref level 0 is meaningless for function <function> parameter <number>

C28300

warning C28300: <parameter_name>: Expression operands of incompatible types for operator <operator_name>

C28301

warning C28301: No annotations for first declaration of <function>.<note1> See <filename>(<line>). <note2>

C28302

warning C28302: For C++ reference-parameter <parameter_name>, an extra _Deref_ operator was found on <annotation>.

C28303

warning C28303: For C++ reference-parameter <parameter_name>, an ambiguous _Deref_ operator was found on <annotation>.

C28304

warning C28304: For C++ reference-parameter <parameter_name>, an improperly placed _Notref_ operator was found applied to <token>.

C28305

warning C28305: An error while parsing <token> was discovered.

C28306

warning C28306: The annotation on parameter is obsolescent

C28307

warning C28307: The annotation on parameter is obsolescent

C28308

warning C28308: The format list argument position specified by the annotation is incorrect.

C28309

warning 28309: <parameter_name>: Annotation operands must be integer/enum/pointer types. Void operands and C++ overloaded operators are not supported. Floats are approximated as integers. Types: <typelist>.

C28350

warning C28350: The annotation <annotation> describes a situation that is not conditionally applicable.

C28351

warning C28351: The annotation <annotation> describes where a dynamic value (a variable) cannot be used in the condition.

Show:
© 2015 Microsoft