On Mon, Jun 22, 2015 at 12:50:21PM +0300, Ludmila Glinskih wrote: > I really don't know how to avoid warnings in printf.
in: libavformat/api-h264-test.c: In function ‘video_decode_example’: libavformat/api-h264-test.c:113:25: warning: format ‘%d’ expects argument of type ‘int’, but argument 5 has type ‘int64_t’ [-Wformat] libavformat/api-h264-test.c:113:25: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 7 has type ‘long unsigned int’ [-Wformat] gcc counts the number of arguments to the function not just the printed arguments so in printf("%d, %10"PRId64", %10"PRId64", %8d, %8d, 0x%08"PRIx32"\n", ^ is the 2nd ^ is the 3rd its not exactly logic but thats how gcc counts, this can easily confuse one so the 5th is the first "%8d" which needs to be a PRId64 or similar the 7th is the '0x%08"PRIx32"' which needs to be type matching long unsigned int which is "0x%08lx" i wonder if theres a complete and clean list somewhere for all the printf() strings for all types, They are in principle written in the C specification but its not exactly the best text to quickly find one for a given type. http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf Thanks -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Its not that you shouldnt use gotos but rather that you should write readable code and code with gotos often but not always is less readable
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel