On Fri, May 3, 2013 at 1:23 PM, Kai Tietz <[email protected]> wrote: > 2013/5/3 Ozkan Sezer <[email protected]>: >> On Fri, May 3, 2013 at 1:09 PM, xunxun <[email protected]> wrote: >>> 于 2013/5/3 星期五 17:59, Ozkan Sezer 写道: >>>> >>>> On Fri, May 3, 2013 at 12:51 PM, niXman <[email protected]> wrote: >>>>> >>>>> Hi JonY, >>>>> >>>>>> If you use -D__MINGW_USE_ANSI_STDIO=1, use %lld. >>>>>> If you DO NOT USE -D__MINGW_USE_ANSI_STDIO=1, use %I64d. >>>>> >>>>> Tell me please, what can be reasons to use '%I64d' and do not use >>>>> '-D__MINGW_USE_ANSI_STDIO=1' ? >>>>> I'm just curious, why not just use the GNU style format string? >>>>> >>>> One may want to avoid mingw-provided print routines, which are linked >>>> statically, and want to use the ones from msvcrt.dll (which is shared >>>> code). >>>> >>>> Personally, I always use windows-native stuff, e.g. %I64 in cases such >>>> as this, but yes it may be hard to do so when porting posix and/or c99- >>>> compliant code which rely on pure conformance. >>>> >>>>> Thanks. >>>>> >>>>> -- >>>>> Regards, >>>>> niXman >>>> >>>> -- >>>> O.S. >>>> >>> Kai wants to set it by default on MinGW(64) >>> >>> -------------------------------------------------- >>> >>> Hi, >>> >>> this patch enables the POSIX-printf variant for mingw-hosts by default. >>> >>> ChangeLog >>> >>> 2013-03-22 Kai Tietz<[email protected]> >>> >>> * config/i386/xm-mingw32.h (__USE_MINGW_ANSI_STDIO): Enable >>> POSIX-printf >>> for mingw-hosted builds. >>> >>> Tested for i686-w64-mingw32, and x86_64-w64-mingw32. I will apply >>> tomorrow, if there aren't any objections by other Windows-maintainers. >>> >>> Regards, >>> Kai >>> >>> Index: gcc/config/i386/xm-mingw32.h >>> =================================================================== >>> --- gcc/config/i386/xm-mingw32.h (Revision 196898) >>> +++ gcc/config/i386/xm-mingw32.h (Arbeitskopie) >>> @@ -29,6 +29,12 @@ along with GCC; see the file COPYING3. If not see >>> /* The st_ino field of struct stat is always 0. */ >>> #define HOST_LACKS_INODE_NUMBERS >>> >>> +#ifdef __MINGW32__ >>> +#undef __USE_MINGW_ANSI_STDIO >>> +#define __USE_MINGW_ANSI_STDIO 1 >>> +#else >>> /* MSVCRT does not support the "ll" format specifier for printing >>> "long long" values. Instead, we use "I64". */ >>> #define HOST_LONG_LONG_FORMAT "I64" >>> +#endif >>> + >>> >>> >>> -- >>> Best Regards, >>> xunxun >>> >> >> Aside from the fact that I don't get the relevance of __MINGW32__ >> check (didn't look at the code), that patch seems to affect gcc's >> own code and not any user code being compiled against mingw. Am I >> wrong? >> >> -- >> O.S. > > You are right. That patch affects gcc's own compilation only. It > doesn't affects user-code. > Nevertheless for libstdc++-v3 uses - starting with 4.8 - by default > POSIX-printf due it relies badly on this behavior internally.
Even then, it affects libstdc++ compilation itself. IMO, mingw[-w64] should not default to __USE_MINGW_ANSI_STDIO=1 by itself and leave the decision to user (which is what we already do at present.) > > Kai -- O.S. ------------------------------------------------------------------------------ Get 100% visibility into Java/.NET code with AppDynamics Lite It's a free troubleshooting tool designed for production Get down to code-level detail for bottlenecks, with <2% overhead. Download for free and get started troubleshooting in minutes. http://p.sf.net/sfu/appdyn_d2d_ap2 _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
