Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 5EC2A476453 for ; Wed, 3 Jul 2002 19:15:59 -0400 (EDT) Mailbox-Line: From raymondf@valentia.com.hk Wed Jul 3 19:15:59 2002 Received: from hk0001.valentia.com.hk (unknown [202.122.75.235]) by postgresql.org (Postfix) with ESMTP id 7AFBC476798 for ; Wed, 3 Jul 2002 16:58:30 -0400 (EDT) Received: from acm.org ([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 g63KwSj17231 for ; Thu, 4 Jul 2002 04:58:29 +0800 Message-ID: <3D2365FC.3E353D4C@acm.org> Date: Thu, 04 Jul 2002 05:00:44 +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 Subject: ecpg problem : pre-processor translated hex 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/55 X-Sequence-Number: 4741 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.