c++ program produces bad results

Gene Smith gds at chartertn.net
Tue Feb 2 05:41:45 UTC 2010


Gene Smith wrote, On 02/01/2010 11:36 PM:
> I have a one-file c++ program that builds and runs fine with g++ on
> linux (f12). It also builds fine when built with i686-pc-mingw32-g++ on
> f12. However, when run under window or wine on linux it produces zeros
> for all double outputs and other incorrect integer results. There are no
> errors indicated other than the output is obviously wrong. Is there a
> trick to getting math intensive c++ programs to work when running
> mingw32 programs?
>
> -gene

I had tried to format with sscanf a long double with "%llf" which 
mingw32 didn't like. Changing it to "%Lf" fixes it (but still see 
warning). Found by compiling with -Wall -Wextra --pedantic. Still don't 
know why it worked OK with native g++.  But still see a a couple of 
small rounding differences between the g++ native program (64bit) and 
running mingw32 program under wine (32 bit version of wine).



More information about the mingw mailing list