Re: MSVC compilers complain about snprintf

From: Andrew Dunstan <andrew(dot)dunstan(at)2ndquadrant(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: MSVC compilers complain about snprintf
Date: 2018-10-17 22:09:07
Message-ID: 1d1d4596-2714-ce0b-9e46-771f438b9a92@2ndQuadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 10/17/2018 05:31 PM, Andres Freund wrote:
> Hi,
>
> On 2018-10-17 17:27:14 -0400, Andrew Dunstan wrote:
>> The MSVC compilers are whingeing about recent changes in snprintf.c:
>>
>>
>> src\port\snprintf.c(1051): warning C4146: unary minus operator
>> applied to unsigned type, result still unsigned
>>
>>
>> The line in question reads:
>>
>> uvalue = -(unsigned long long) value;
> Yea, that's intended. Is there a way to silence that one, but just keep
> the code largely similar?

Probably something like:

#if (_MSC_VER >= 1800)
#pragma warning(disable:4146)
#endif

based on float.h.

cheers

andrew

--
Andrew Dunstan https://www.2ndQuadrant.com
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2018-10-17 22:11:51 Re: Alter index rename concurrently to
Previous Message Thomas Munro 2018-10-17 22:08:33 Re: DSM robustness failure (was Re: Peripatus/failures)