Re: ecpg compile error on AIX - Mailing list pgsql-hackers

From Michael Meskes
Subject Re: ecpg compile error on AIX
Date
Msg-id 20020108142239.GE6735@feivel.fam-meskes.de
Whole thread Raw
In response to Re: ecpg compile error on AIX  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, Jan 07, 2002 at 12:40:07PM -0500, Tom Lane wrote:
> ind_offset is already a sizeof() measure, isn't it?
> I would guess that what you want is
> 
> >  *((long long int *) ((char *)ind + ind_offset*act_tuple)) = variable->len;
> 
> since ind_offset*act_tuple is a number expressed in bytes, and should
> not be scaled up by sizeof(long long int).

Yes, you're right of course. I should have thought more before typing.

> Also, if the code works for you at all, it's because GCC is (in
> violation of the ANSI C standard) interpreting the construct as
> addition to char* rather than addition to void*.  Casting to anything
> other than char* will change the behavior.

That's what I was afraid of and why I asked for some testing on other archs. 
Right now I only have access to Intel based Linux.

> (Might be a lot easier just to declare ind as char* instead of void*
> in the first place...)

Did that. My test cases all work well. Please test on HP, AIX or whatever.

Michael
-- 
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!


pgsql-hackers by date:

Previous
From: Kaare Rasmussen
Date:
Subject: Re: Updated TODO item
Next
From: Michael Meskes
Date:
Subject: Re: ecpg compile error on AIX