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
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

Compiler Warning (level 1) C4313

Error Message

'function' : 'format specifier' in format string conflicts with argument %d of type 'type'

There is a conflict between the format specified and the value that you are passing. For example, you passed a 32-bit pointer to %d format specifier, which can hold a 64-bit integer. This warning is only in effect with /Wp64.

Example

The following code sample generates C4313.

// C4313.cpp
// compile with: /W1 /Wp64
#include <stdio.h>
int main() {
   int * pI = 0;
   printf("%d", pI);   // C4313
   // try one of the following lines instead
   // printf("%p\n", pI);
   // printf("%Id\n", pI);   // %I64d expects 64-bits of information
}

Community Additions

ADD
Show:
© 2015 Microsoft