[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lmi] _get_output_format() signature MinGW 4

From: Greg Chicares
Subject: Re: [lmi] _get_output_format() signature MinGW 4
Date: Wed, 22 Jun 2011 17:38:20 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv: Gecko/20110414 Thunderbird/3.1.10

On 2011-06-21 23:53Z, Vadim Zeitlin wrote:
>  Reviewing my changes I realized that I forgot another small problem I had
> when building LMI with MinGW 4: the return value of _get_output_format() is
> 'unsigned" and not just "int". Hence the line
> extern "C" int _get_output_format(void) {return 1;}
> in main_common.cpp results in an error about incompatible redeclaration of
> this function and I had to change it to
> extern "C" unsigned int _get_output_format(void) {return 1;}
> to fix this. I don't really understand why was "int" used for MinGW 3 as
> looking at its stdio.h I see that _get_output_format() is declared as
> returning "unsigned" there too.

"int" is what the author wrote in the article you cite below, but upon
reflection it seems that it may always have been incorrect. Corrected
20110622T1736Z in revision 5213. (I'll change the 'skeleton' trunk
later if necessary.)

>  But this is ugly and looking at the message referenced in the comment
> above this function I see that apparently using this function is some sort
> of a hack in the first place and that, quoting
> http://article.gmane.org/gmane.comp.gnu.mingw.user/28747
>       adding PRINTF_EXPONENT_DIGITS=2 to your environment remains 
>       the preferred way to achieve this
>  So maybe we could do this instead?

As I understand it, that would need to be done in the end user's environment,
not the developer's. Typical end users in corporations do not have permission
to modify the environment. And, even if they can, they might fail to, causing
the program to behave in a different way than we intend.

> Or, potentially even simpler, why not
> call _set_output_format(1) instead of replacing _get_output_format()? I am
> not sure to understand all the ramifications of VC CRT version influence on
> MinGW though so maybe this isn't as simple as that... but then again, maybe
> it is?

I don't know whether that would work, but it's not among the options given by
the author, so I wouldn't want to rely on it.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]