I am getting a compiler warning when I build the latest HEAD PostgreSQL with
visual studio 2017.

src/backend/replication/logical/proto.c(482): warning C4312: 'type cast':
conversion from 'unsigned int' to 'char *' of greater size

Details of the warning is available in the link [1].

The code at the line is,

tuple->values[i] = (char *) (Size)0xdeadbeef; /* make bad usage more
obvious */

If I change the code as (char *) (Size)0xdeadbeef;
or (char *) (INT_PTR)0xdeadbeef; the warning disappears.

How about fixing it as below and add the typecast or disable
this warning?

 * Used when converting integer addresses to a pointer.
 * The casting is used to avoid generating warning in
 * windows
#ifdef WIN32
#define PTR_CAST

[1] - https://msdn.microsoft.com/en-us/library/h97f4b9y.aspx

Hari Babu
Fujitsu Australia

Reply via email to