Re: Some architectures need "signed char" declarations

From: Doug McNaught <doug(at)wireboard(dot)com>
To: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Some architectures need "signed char" declarations
Date: 2002-01-09 13:42:00
Message-ID: m3pu4jabfb.fsf@varsoon.denali.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Oliver Elphick <olly(at)lfix(dot)co(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dwayne Miller 2002-01-09 14:52:43 Re: Time as keyword
Previous Message Oleg Bartunov 2002-01-09 13:27:58 Re: RC1 time? (Server time)