Win64 warnings about size_t

Поиск
Список
Период
Сортировка
От Magnus Hagander
Тема Win64 warnings about size_t
Дата
Msg-id 9837222c1001010932j523921a7j5abebc46e4456210@mail.gmail.com
обсуждение исходный текст
Ответы Re: Win64 warnings about size_t  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Win64 warnings about size_t  (Bruce Momjian <bruce@momjian.us>)
Список pgsql-hackers
I have adapted the win64 patches a bit, and now have a working build.
As in it runs the regression tests fine. However, I have well over a
thousand warnings of the type:
conversion from 'size_t' to 'int', possible loss of data

My first 5-6 checks of where these happen are all cases where we
assign the result of strlen() something to an int, or call a function
taking an int as parameter with the result of strlen() in there.

strlen() returns size_t, which AFAICS is per the standard and not even
a Microsoft-specific idea. size_t is 8-bit - but it appears to be
8-bit on Linux as well, when in 64-bit mode.

So I don't really see what win64 does differently in this case, but
perhaps I've been looking at this code too long? Or is it simply that
MSVC warns about this and GCC doesn't, and I shuld disbale the
warning?

A couple of points for reference:

1>.\src\backend\utils\adt\varlena.c(84) : warning C4267: 'function' :
conversion from 'size_t' to 'int', possible loss of data
1>.\src\backend\utils\adt\varlena.c(158) : warning C4267: 'function' :
conversion from 'size_t' to 'int', possible loss of data
1>.\src\backend\utils\adt\varlena.c(158) : warning C4267: 'function' :
conversion from 'size_t' to 'int', possible loss of data
1>.\src\backend\utils\adt\varlena.c(201) : warning C4267: '=' :
conversion from 'size_t' to 'int', possible loss of data
1>.\src\backend\utils\adt\varlena.c(203) : warning C4267: 'function' :
conversion from 'size_t' to 'unsigned int', possible loss of data
1>.\src\backend\utils\adt\varlena.c(488) : warning C4267: 'function' :
conversion from 'size_t' to 'int', possible loss of data
1>.\src\backend\utils\adt\varlena.c(2156) : warning C4267: 'function'
: conversion from 'size_t' to 'int', possible loss of data
1>.\src\backend\utils\adt\varlena.c(3131) : warning C4267: '=' :
conversion from 'size_t' to 'int32', possible loss of data
1>.\src\backend\utils\adt\varlena.c(3136) : warning C4267: '=' :
conversion from 'size_t' to 'int32', possible loss of data


-- Magnus HaganderMe: http://www.hagander.net/Work: http://www.redpill-linpro.com/


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Cancelling idle in transaction state
Следующее
От: Simon Riggs
Дата:
Сообщение: Re: Cancelling idle in transaction state