Re: Some architectures need "signed char" declarations

Поиск
Список
Период
Сортировка
От Doug McNaught
Тема Re: Some architectures need "signed char" declarations
Дата
Msg-id m3pu4jabfb.fsf@varsoon.denali.to
обсуждение исходный текст
Ответ на Some architectures need "signed char" declarations  (Oliver Elphick <olly@lfix.co.uk>)
Ответы Re: Some architectures need "signed char" declarations
Список pgsql-hackers
Oliver Elphick <olly@lfix.co.uk> writes:

> I recently got a Debian bug report about 3 architectures where char is
> unsigned by default.  There were 2 locations identified in the code
> where a char is compared with a negative value, and should therefore be
> declared as a "signed char".  There may be others in 7.2, but I don't
> myself have access to a suitable machine for testing.
> 
> The locations I am aware of are:
> 
>     src/backend/libpq/hba.c    GetCharSetByHost(): if (c == EOF)
>     src/backend/utils/init/miscinit.c  SetCharSet(): if (c == EOF)
> 
> The architectures are Linux on: arm, powerpc and s390.

Hmmm, according to my knowledge of C, 'c' should be an int here, as
EOF is guaranteed not to collide with any legal char value.  With 'c'
an unsigned char, ASCII 255 and EOF would be indistingushable on
twos-complement machines. 

-Doug
-- 
Let us cross over the river, and rest under the shade of the trees.  --T. J. Jackson, 1863


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

Предыдущее
От: mlw
Дата:
Сообщение: Re: RC1 time? (Server time)
Следующее
От: Oleg Bartunov
Дата:
Сообщение: Re: RC1 time? (Server time)