Обсуждение: pgsql: Removed comparison of unsigned expression < 0.
pgsql: Removed comparison of unsigned expression < 0.
От
meskes@postgresql.org (Michael Meskes)
Дата:
Log Message: ----------- Removed comparison of unsigned expression < 0. Modified Files: -------------- pgsql/src/backend/utils/adt: tsvector.c (r1.15 -> r1.16) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/tsvector.c?r1=1.15&r2=1.16) pgsql/src/interfaces/libpq: fe-exec.c (r1.200 -> r1.201) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/libpq/fe-exec.c?r1=1.200&r2=1.201) fe-misc.c (r1.138 -> r1.139) (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/libpq/fe-misc.c?r1=1.138&r2=1.139)
meskes@postgresql.org (Michael Meskes) writes: > Log Message: > ----------- > Removed comparison of unsigned expression < 0. I believe that this change is a bad idea and should be reverted: > fe-exec.c (r1.200 -> r1.201) > (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/libpq/fe-exec.c?r1=1.200&r2=1.201) This is correct only if enum ExecStatusType is considered unsigned by the compiler, an assumption that I don't believe is portable. (In fact, Zdenek was just complaining about something else that seems to prove Solaris' compiler treats enums as signed always.) The other two changes seem ok, since they are for size_t variables which are definitely supposed to be unsigned. regards, tom lane
On Tue, May 26, 2009 at 06:51:57PM -0400, Tom Lane wrote: > I believe that this change is a bad idea and should be reverted: > > > fe-exec.c (r1.200 -> r1.201) > > (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/interfaces/libpq/fe-exec.c?r1=1.200&r2=1.201) > > This is correct only if enum ExecStatusType is considered unsigned by > the compiler, an assumption that I don't believe is portable. (In Enums per se are signed, but enum ExecStatusType should never be negative since it starts with "PGRES_EMPTY_QUERY = 0" and then increases for the other values. > fact, Zdenek was just complaining about something else that seems to > prove Solaris' compiler treats enums as signed always.) Okay, before this provides any problem I revert to be on the safe side. Michael -- Michael Meskes Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org) Michael at BorussiaFan dot De, Meskes at (Debian|Postgresql) dot Org ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org Go VfL Borussia! Go SF 49ers! Use Debian GNU/Linux! Use PostgreSQL!