Thread

Commits

  1. Disable MSVC warning caused by recent snprintf.c changes

  2. Ensure that snprintf.c's fmtint() doesn't overflow when printing INT64_MIN.

  1. MSVC compilers complain about snprintf

    Andrew Dunstan <andrew.dunstan@2ndquadrant.com> — 2018-10-17T21:27:14Z

    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;
    
    cheers
    
    andrew
    
    -- 
    Andrew Dunstan                https://www.2ndQuadrant.com
    PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
    
    
    
    
  2. Re: MSVC compilers complain about snprintf

    Andres Freund <andres@anarazel.de> — 2018-10-17T21:31:31Z

    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?
    
    Greetings,
    
    Andres Freund
    
    
    
  3. Re: MSVC compilers complain about snprintf

    Andrew Dunstan <andrew.dunstan@2ndquadrant.com> — 2018-10-17T22:09:07Z

    
    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
    
    
    
    
  4. Re: MSVC compilers complain about snprintf

    Tom Lane <tgl@sss.pgh.pa.us> — 2018-10-17T22:11:55Z

    Andrew Dunstan <andrew.dunstan@2ndquadrant.com> writes:
    > 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
    
    Yeah, see commit 4868e4468590bc32f9c3afed4ec795d6a7732c9d.
    
    The law of conservation of warning messages seems to be at work :-(
    
    			regards, tom lane