fixing INT64_FORMAT warnings on Mingw

Started by Andrew Dunstanover 14 years ago3 messages
#1Andrew Dunstan
andrew@dunslane.net

Both "%lld" and "%I64d" can be used with mingw to print 64 bit integers.
However, modern versions of gcc spit warnings with the former, and not
the latter. However, since "%lld" works, it is chosen by our config
setup since it comes first in the list of formats tried. Therefore, to
keep the compiler happy I proposed to rearrange that so that "%I64d" is
preferred if it's found to work.

Thoughts?

cheers

andrew

#2Peter Eisentraut
peter_e@gmx.net
In reply to: Andrew Dunstan (#1)
Re: fixing INT64_FORMAT warnings on Mingw

On Wed, 2011-04-27 at 00:01 -0400, Andrew Dunstan wrote:

Both "%lld" and "%I64d" can be used with mingw to print 64 bit integers.
However, modern versions of gcc spit warnings with the former, and not
the latter. However, since "%lld" works, it is chosen by our config
setup since it comes first in the list of formats tried. Therefore, to
keep the compiler happy I proposed to rearrange that so that "%I64d" is
preferred if it's found to work.

We should prefer the standard syntax (%lld) over nonstandard ways.
There could just as well be platforms that accept %I64d but warn about
it (as being nonstandard).

If that doesn't work for a specific platform, either adjust the test so
that it checks for warnings, or just manually override the result in
pg_config_os.h.

#3Andrew Dunstan
andrew@dunslane.net
In reply to: Peter Eisentraut (#2)
Re: fixing INT64_FORMAT warnings on Mingw

On 04/27/2011 09:00 AM, Peter Eisentraut wrote:

On Wed, 2011-04-27 at 00:01 -0400, Andrew Dunstan wrote:

Both "%lld" and "%I64d" can be used with mingw to print 64 bit integers.
However, modern versions of gcc spit warnings with the former, and not
the latter. However, since "%lld" works, it is chosen by our config
setup since it comes first in the list of formats tried. Therefore, to
keep the compiler happy I proposed to rearrange that so that "%I64d" is
preferred if it's found to work.

We should prefer the standard syntax (%lld) over nonstandard ways.
There could just as well be platforms that accept %I64d but warn about
it (as being nonstandard).

If that doesn't work for a specific platform, either adjust the test so
that it checks for warnings, or just manually override the result in
pg_config_os.h.

I did it that way.

cheers

andrew