Re: [HACKERS] compiler warning with VS 2017 - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] compiler warning with VS 2017
Date
Msg-id 14015.1493959815@sss.pgh.pa.us
Whole thread Raw
In response to [HACKERS] compiler warning with VS 2017  (Haribabu Kommi <kommi.haribabu@gmail.com>)
Responses Re: [HACKERS] compiler warning with VS 2017  (Petr Jelinek <petr.jelinek@2ndquadrant.com>)
List pgsql-hackers
Haribabu Kommi <kommi.haribabu@gmail.com> writes:
> I am getting a compiler warning when I build the latest HEAD PostgreSQL with
> visual studio 2017.
> The code at the line is,
> tuple->values[i] = (char *) (Size)0xdeadbeef; /* make bad usage more obvious */

Yeah, you're not the first to complain about this.  To my mind that
coding is not pretty, not cute, and not portable: there's not even
a good reason to believe that dereferencing the pointer would result
in a crash.  Perhaps the author can explain to us why this is better
than just assigning NULL.

Actually, looking around a bit there, it's not even clear why
we should be booby-trapping the value of an unchanged column in
the first place.  So I'd say that not only is the code dubious
but the comment is inadequate too.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [HACKERS] CTE inlining
Next
From: Amit Kapila
Date:
Subject: Re: [HACKERS] statement_timeout is not working as expected with postgres_fdw