Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 01ACE475F4A; Wed, 3 Jul 2002 23:37:24 -0400 (EDT) Mailbox-Line: From raymondf@acm.org Wed Jul 3 23:37:23 2002 Received: from hk0001.valentia.com.hk (unknown [202.122.75.235]) by postgresql.org (Postfix) with ESMTP id 54EA1476842; Wed, 3 Jul 2002 21:57:52 -0400 (EDT) Received: from iohk.com ([61.144.142.120]) by hk0001.valentia.com.hk (8.11.2/8.11.2/SuSE Linux 8.11.1-0.5) with ESMTP id g641vtj18124; Thu, 4 Jul 2002 09:57:55 +0800 Message-ID: <3D23AC21.FC1D6579@iohk.com> Date: Thu, 04 Jul 2002 10:00:01 +0800 From: Raymond Fung X-Mailer: Mozilla 4.78 [en] (Win98; U) X-Accept-Language: en,zh-CN,zh-TW MIME-Version: 1.0 To: pgsql-admin , pgsql-hackers Subject: ecpg problem : pre-processor translated long constant to char Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=1.0 required=5.0 tests=TO_LOCALPART_EQ_REAL,RCVD_IN_RFCI version=2.30 X-Spam-Level: * X-Archive-Number: 200207/53 X-Sequence-Number: 4739 Dear all, A simple testing program : * * * * * * * * * * * * * * begin * * * * * * * * * * * * * * * * #include #include int main (void) { unsigned int v; v = 0x87654321L; return (0); } * * * * * * * * * * * * * * end * * * * * * * * * * * * * * * * compile with ecpg using : ecpg -o mytest.c -I/usr/include/pgsql mytest.pgc produces the output C program file as follow : * * * * * * * * * * * * * * begin * * * * * * * * * * * * * * * * /* Processed by ecpg (2.8.0) */ /* These three include files are added by the preprocessor */ #include #include #include #line 1 "test.pgc" #include #include int main (void) { unsigned int v; v = '0x87654321'L; return (0); } * * * * * * * * * * * * * * * end * * * * * * * * * * * * * * * It has translated the 4 bytes constant (0x87654321) into a one byte char constant (within the single quotes) during pre-processing. Seems this happens only when the high bit of the constant is set (i.e. it won't add the quotes if the constant is 0x12345678). Also, I noticed that the line number reported during the preprocessing error output is incorrect : it is '1' less than the actual line number in the source file. As shown, I am using version 2.8.0 of ecpg. Is my version being too old to be buggy ? Any suggestion to bypass the translation problem ? Thanks, Raymond Fung.