Re: ecpg compile error on AIX

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Meskes <meskes(at)postgresql(dot)org>
Cc: 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-07 17:40:07
Message-ID: 9677.1010425207@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Meskes <meskes(at)postgresql(dot)org> writes:
> Does it work with this?

> *((long long int *) ((long long int *)ind + ind_offset*act_tuple)) = variable->len;

> If it does we have to check whether that does what I expect it to.

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).

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.

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

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Gilles DAROLD 2002-01-07 17:51:19 Problem with view and fetch_fields
Previous Message Tom Lane 2002-01-07 17:28:12 Re: Why MemoryContextSwitch in ExecRelCheck ?