Diagnostic 269: invalid format string conversion


Casue: 

This warning is triggered by a printf or scanf format specifier that is not appropriate for the type of the variable being printed.


Example: 

#include <stdio.h>

int main() {
   long int li = 0;
   printf("%ln",li);     // %l is the size specifier; the type specifer is missing
   printf("%ldn",li);  // OK
   return 0;
}

 

> icl -c /W4 diag269.cpp
Intel® C++ Compiler Professional for applications running on IA-32, Version 11.1    Build 20090511 Package ID: w_cproc_p_11.1.035
Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.

diag269.cpp
diag269.cpp(5): warning #269: invalid format string conversion
printf("%l\n",li);
           ^ 



Resolution :

Use proper type specifier.


For more complete information about compiler optimizations, see our Optimization Notice.