Web lists-archives.com

Re: [Mingw-users] bizarre problem, need help from a mingw developer




-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 09/03/16 21:53, mathog wrote:
>> The bottom line is that MSDN says that "%lf" refers to a long
>> double, and __mingw_printf() interprets that to mean a GCC long
>> double.
> 
> According to the C and C++ language standards that is wrong and has
> been for 15 years or so.  Don't modern Microsoft development
> environments now use "%lf" in compliance with the C/C++ language
> standards?

AFAIK, no they do not.  You can read it just as easily as I can, but
MSDN still says that "%lf" refers to a long double, just as "%Lf"
does; however, for users MSVC users, that's mostly irrelevant, because
their compiler doesn't implement long doubles in any way which is
distinct from plain old double.

> The compilers supply their own run time libraries which take 
> precedence for functions like printf() over the very old MSVCRT 
> supplied with the OS,

Yes, newer versions of MSVC use their own individual versions of
MSVCR?.DLL; all are non-free, incompatible with the GPL, and therefore
cannot be used by MinGW, which must use the the MSVCRT.DLL supplied
with the OS.  However, you are quite wrong to describe this as "very
old"; each new version of the OS delivers a new, updated version of
MSVCRT.DLL, (which nonetheless, may not be entirely compatible with
the non-free MSVCR?.DLL variants accompanying MSVC compilers).  What
these compilers may, or may not do, is mostly irrelevant here anyway;
this list exists to serve users of MinGW's GCC, not users of MSVC.

> so doing it the ANSI way is not difficult.  I wonder if they may
> not now also use an 80 bit long double, so that "%Lf" means
> something different from "%f", and long doubles may actually be
> used to print numbers with more precision.

According to MSDN, no.

> I understand you do not much care for the language standard's 
> requirements for "%lf", but since the standard is as it is,

I consider it to be extremely bad programming to rely of a feature
which is expected to have no effect.  What is the point?  Your code
will be significantly more comprehensible -- you write "%f", and
everybody knows what you mean; writing "%lf" introduces an element of
confusion, and, especially when Microsoft enters the equation, makes
your code less robust.

> it would be nice if
> 
> gcc -std=c99
> 
> in mingw linked in a _printf() that did what the language says it
> should do, rather than what MS compilers did long ago (or still do,
> for all I know).  More power to you if you also want to implement
> 
> gcc -std=MSDN
> 
> or something like that, to match the (old?) MS requirements.

Microsoft's compilers have never been ISO-C99 compliant.  In the last
year or so, they have been paying a bit of lip service to C99, but
they still aren't compliant, (and their own conventions continue to
trump ISO standards).  As a Windows compiler implementer, using
Microsoft's runtime, our language reference is MSDN, and MSDN still
says that "%lf" refers to a long double, so the current
__mingw_printf() is somewhat justified in interpreting it so.
Nonetheless, (and I'm getting extremely irritated by being continually
invited to repeat myself here), the next release [*] of mingwrt will
deprecate interpretation of "%lf" in this way, leaning towards a more
ISO-C99 interpretation, (also justifiable on the grounds of
Microsoft's lack of a true long double implementation in any case); it
will, however, continue to support non-standard conventions such as
"%I64d" as an alias for "%lld", (which Microsoft used not to support,
and may still not, in MSVCRT.DLL), and it will add support [*] for the
POSIX.1-2008 "%n$"/"*m$" argument referencing format specifiers.

[*] These changes are already committed to our git code repository, so
if you can't wait for a release, feel free to clone and build it for
yourself.  (The active branch is called "legacy"; don't use "master",
unless you really want the broken v4 implementation).

- -- 
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.20 (GNU/Linux)

iQIcBAEBAgAGBQJW4K2MAAoJEMCtNsY0flo/k1cQAMXAd0O8R8NWar4mJn+4VYlW
EOeZvfjLkXgedwN2CQVazQVjFg7nYkRKw45KPaT2qlVMiSveGwwP+LgC7mq4j+0S
DMfT6LCeWgY03a79wj4XylX+ibLFszsIv7Q4HeBvsbbhXtSUTSzzC3dfpcy814Xt
GXX6xOSbwL1IPuBUiGbBMEL5OpV8LIrvBBKW9i9BHnTOPCo28YAmcE8Uf5CN9TkR
L/5Eax6A4KJ/IVidqnnqjBD+kEEKkRdi3z/VVLs7jG2gWzGedRK8/cE3CP9UBUSq
nEmhjqakdE14G6XKTMpwDBmiFRibp8BQn75mFbTcmRtj8guRDTHnsMEKZ0cHcksy
N+zjcbT2v1M3TsarifQBmfonh3BSrK0OuhzoM3vsfNSijjVW/50yHT9NviyJ5A7g
3n3x7Zi3SyRrOEMjcwRWln7lQsPWML72JiBo2+sLHLRrFCHNDlP9MSo6pJ+xtSqb
+9cnqat7QUa8ubpBAp3etlPGXdRH5Ipcz8LExm3wQb0FTPp7JMBj4IwNyKkFclXL
TcYSgVNdDbMDPPAcgJ3tJIUxwU1O9G6snnPyfEpFwb5fcC2XXIS/fUva8g5cePF8
zAnGkueYOV88ZVgJGWcimzvUcGsvVp7EjJM8T7XefOg/HfUzaWpa92ZdjD+w39q9
OPmcnchFGGaeW0mSz8Ao
=YoKL
-----END PGP SIGNATURE-----

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
_______________________________________________
MinGW-users mailing list
MinGW-users@xxxxxxxxxxxxxxxxxxxxx

This list observes the Etiquette found at 
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@xxxxxxxxxxxxxxxxxxxxx?subject=unsubscribe