For broadest compatibility I suggest C99 standard, #include <stdint.h> and
ull or ll as the Plan A, and if your compiler doesn't work with that humor
it with an ifdef.  The C99 standard works for me for the Linux hosted
cross-compilers.

 

James K Beard

 

From: Jim Michaels [mailto:jmich...@yahoo.com] 
Sent: Wednesday, March 23, 2011 3:09 AM
To: Kai Tietz; mingw64
Subject: Re: [Mingw-w64-public] missing long double format in printf

 

why does ll not work for int64_t and long long (I think) and __int64?

this is quite noticeable.  all my programs have to be #ifdef'd.

#if defined(__BORLANDC__)||defined(__MINGW32__)||defined(_MSC_VER)
printf("%I64d", int64_t(2)); //don't try this with ll
#elif defined(__DJGPP__)
printf("%lld", int64_t(2)); //don't try this with ll
#endif

ugh.  it would be simpler and shorter if I could simply do __GNUC__ or just
use ll all the time.

the only reason I am posting this back on mingw-w64 mailing list is because
the ifdefs might be useful for someone making portable code.

 

  _____  

From: Kai Tietz <ktiet...@googlemail.com>
To: Jim Michaels <jmich...@yahoo.com>
Sent: Tue, March 22, 2011 12:48:20 AM
Subject: Re: [Mingw-w64-public] missing long double format in printf

2011/3/22 Jim Michaels <jmich...@yahoo.com>:
> if you are using __USE_MINGW_ANSI_STDIO can you still use %I64u?

Well, POSIX equivalent for 'I64' width specifier is 'll'. Btw this is
supported by newer msvcrt-C-runtimes, too. I would recomment not to
use in ISO-C99 variant the width-specifier I64 for compatiblity sake.
You can use here for compatiblity sake inttypes.h header and its
defines to abstract width encoding.

Regards,
Kai

 

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to