Re: ecpg compile error on AIX

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Meskes <meskes(at)postgresql(dot)org>, Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: ecpg compile error on AIX
Date: 2002-01-08 14:22:39
Message-ID: 20020108142239.GE6735@feivel.fam-meskes.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)Fam-Meskes(dot)De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Meskes 2002-01-08 14:22:55 Re: ecpg compile error on AIX
Previous Message Ulrich Neumann 2002-01-08 14:19:08 Antw: Re: (void *) with shmat