2011/12/17 David Cleaver <[email protected]>:
>
> On 12/17/2011 10:41 AM, Kai Tietz wrote:
>> 2011/12/17 Ozkan Sezer:
>>> On Sat, Dec 17, 2011 at 6:09 PM, David Cleaver wrote:
>>>>
>>>>
>>>> On 12/17/2011 9:24 AM, Ozkan Sezer wrote:
>>>>> On Sat, Dec 17, 2011 at 4:49 PM, David Cleaver wrote:
>>>> I know that putting
>>>> #define __USE_MINGW_ANSI_STDIO 1
>>>> at the top of the code will allow my build to be able to use %llu to print
>>>> the
>>>> 64-bit variable. However, I'm wondering why his compiler warns about the
>>>> unknown llu modifier, but still prints the full 64-bit value.
>>>
>>> I don't have an answer for that,
>>
>> The ll width specifier isn't supported by all msvcrt version.
>> Equivalent for target would be I64. Beginning with OS Vista (IIRC)
>> the msvcrt printf/scanf faimily routines are supporting ll, too. But
>> to avoid breakage with older msvcrt, gcc has to warn about it.
>>
>> See msvcrt.dll's version. It is related to it.
>
> I see lots of information online regarding when Visual Studio/Visual C++
> versions started being able to use the ll modifier (since version VC++
> 2003/7.1,
> apparently), but I don't see the same information detailing when msvcrt.dll
> was
> able to use the ll modifier.
>
> On my Windows XP x64 SP2 computer, my c:\windows\system32\msvcrt.dll has
> version
> 7.0.3790.3959. I'd like to compile a list of msvcrt.dll versions and whether
> or
> not they support the ll modifier.
>
> Would others on this list try to compile the following test program to see
> whether or not the full 64bit number is printed? And after that, could you
> report back here to let us know if it worked or not, and what version of
> msvcrt.dll you have, and what version of OS you are running?
>
> #include <stdio.h>
> #include <inttypes.h>
>
> int main(void) {
> uintmax_t x = 1125899906842749LL;
> printf("%llu\n", x);
> return 0;
> }
>
>
>
>
> Kai/Ozkan, so when I compile a program with printf, how does mingw64 know
> which
> OS dll will handle the printf. Or is an assumption made that msvcrt.dll will
> be
> available to handle the request? Or do you just past the printf "to the OS"
> and
> the OS knows how to fill the printf request?
>
> -David C.
The mingw runtimes (mingw.org or mingw-w64) are using in default case
microsoft's runtime msvcrt.dll (which is until now part of the OS and
therefore always present) of the operating system. We don't provide
our own C-runtime. Actual mingw-w64 is working on an alternative
C-runtime - code-name is ironCrate - but this is still under
construction and first real parts for it won't be published before
next year for sure.
So to be clear, by default we take care that C.runtime functions in
msvcrt are called . In some parts we actually are providing some *nix
compatible functions, doing some adjustement to get better
compatiblity to common gnu-software, and we provide additional
math-functions in an ISO-C way. Actually we don't know on compile
time and not on runtime (as it makes for us no difference at all) what
version that might be. So programmer is responsible to use the proper
formatting-arguments for it, as nobody will modify it for you.
The atleternative version we - as mingw-w64 - are providing are the
POSIX-printf/scanf family routines - available for ascii and
widecharacers set available via defining __USE_MINGW_ANSI_STDIO -
which have formatters as specified for common unix-systems.
But another way to solve here your puzzle to choose proper
printf/scanf specifiers is the standard inttypes.h header. This allows
you to write code, which is unaffected by runtimes formatter rules.
Eg to print a 'long long' type integer-scalar you can use the
following code pattern
#include <stdio.h>
#include <inttypes.h>
....
printf ("%" PRIidMAX "\n", (long long) value);
...
Modern C-runtime headers are providing this header in common.
Regards,
Kai
------------------------------------------------------------------------------
Learn Windows Azure Live! Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for
developers. It will provide a great way to learn Windows Azure and what it
provides. You can attend the event by watching it streamed LIVE online.
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public