Windows 64 bit warnings

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Windows 64 bit warnings
Дата
Msg-id 4DAA3874.2090903@dunslane.net
обсуждение исходный текст
Ответы Re: Windows 64 bit warnings  (Alvaro Herrera <alvherre@commandprompt.com>)
Re: Windows 64 bit warnings  (Michael Meskes <meskes@postgresql.org>)
Re: Windows 64 bit warnings  (Michael Meskes <meskes@postgresql.org>)
Список pgsql-hackers
While looking into setting up some libraries to use for 64 bit Windows 
builds, I took a quick look at the output from the 64 bit postgres 
builds currently running. They're actually quite clean, a heck of a lot 
cleaner than several other packages I have been looking at, quite a good 
testament to the cleanliness of our code. I was looking specifically for 
instances of warnings like "warning: cast to pointer from integer of 
different size" or the other way around, and found just two.

One is at src/interfaces/ecpg/ecpglib/sqlda.c:231, which is this line:
   sqlda->sqlvar[i].sqlformat = (char *) (long) PQfformat(res, i);

I'm not clear about the purpose of this anyway. It doesn't seem to be 
used anywhere, and the comment on the field says it for future use. If 
we're going to do it, I think it should be cast to a long long on Win64, 
since a char * is 8 bytes there, while a long is only 4. But if we 
really want to store the result from PQfformat() in it, why is it a char 
* at all?

The other, slightly more serious case, is at 
src/test/regress/pg_regress.c:2280, which is this code:
   printf(_("running on port %d with pid %lu\n"),        port, (unsigned long) postmaster_pid);

Here the postmaster_pid is in fact a HANDLE which is 8 bytes, and so it 
should probably be cast to an unsigned long long and  rendered with the 
format %llu in Win64.

cheers

andrew




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

Предыдущее
От: Tom Lane
Дата:
Сообщение: WIP patch for allowing COLLATE in plpgsql variable declarations
Следующее
От: Christopher Browne
Дата:
Сообщение: Re: Formatting Curmudgeons WAS: MMAP Buffers