ECPG fails to handle hex constants

From: Thad Humphries <thad(at)mindwrap(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: ECPG fails to handle hex constants
Date: 2002-10-15 16:44:14
Message-ID: 1034700254.31092.24.camel@opus
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I stumbled across this bug yesterday. My compiler (gcc 2.95.3 on RedHat
6.2) was telling me

query.pgc:1383: character constant too long

so I compiled to query.c vs. query.o. I found that

if ( field->flags & 0x80000000 )
became
if ( field->flags & '0x80000000' )

after passing thru ecpg, although it does not appear inside any EXEC SQL
clauses. (field->flags is an 's32' which is typedef'd from int.)

I worked around this problem by thus

/* Do this else ECPG makes 0x80000000 a char */
#define MASK_HI_BIT 0x80000000
...
if ( field->flags & MASK_HI_BIT )

which leaves it all to the C preprocessor. But why should I have to?
Is this really a bug in ecpg?
------------------------------------------------------------------------
Thad Humphries "...no religious test shall ever be required
Web Development Manager as a qualification to any office or public
Phone: 540/675-3015, x225 trust under the United States." -Article VI

Browse pgsql-novice by date

  From Date Subject
Next Message Frank Bax 2002-10-15 19:28:39 help deleting obsolete records
Previous Message Josh Berkus 2002-10-15 16:38:47 Re: db design question