2007年8月6日 星期一

Using long long with MinGW

long long是 C99的標準,可以處理-((2^63)-1)~(2^63)-1的數字,正常使用方法是 %lld /u/x,但如果使用MinGW來編譯的話,必須用%I64d /u/x 才能正常使用

The printf() implementation used by MinGW (which is provided by msvcrt.dll) uses its own format specifier for 64-bit integers as documented in MSDN: http://msdn.microsoft.com/library/en-us/vccore98/HTML/_crt_size_and_distance_specification.asp. For example, %I64d will format a (decimal) long long and %I64u will format an unsigned long long.

參考資料:http://www.mingw.org/MinGWiki/index.php/long%20long

沒有留言: