"24" < INT_MIN returns TRUE ???

From: wieck(at)debis(dot)com (Jan Wieck)
To: pgsql-hackers(at)postgreSQL(dot)org (PostgreSQL HACKERS)
Subject: "24" < INT_MIN returns TRUE ???
Date: 1999-07-08 16:14:02
Message-ID: m112GoE-0003ktC@orion.SAPserv.Hamburg.dsh.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

did anyone compile latest CVS with v1.31
utils/adt/numutils.c?

Marc activated some range checks in pg_atoi() and now I have
a very interesting behaviour on a Linux box running gcc 2.8.1
glibc-2.

Inside of pg_atoi(), the value is read into a long. Comparing
a small positive long like 24 against INT_MIN returns TRUE -
dunno how. Putting INT_MIN into another long variable and
comparing the two returns the expected FALSE - so what's
going on here? long, int32 and int have all 4 bytes here.

Someone any clue?

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#========================================= wieck(at)debis(dot)com (Jan Wieck) #

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 1999-07-08 16:18:00 Re: [HACKERS] Arbitrary tuple size
Previous Message Ross J. Reedstrom 1999-07-08 16:06:43 CVS broken