Re: ecpg compile error on AIX

From: Michael Meskes <meskes(at)postgresql(dot)org>
To: Tatsuo Ishii <t-ishii(at)sra(dot)co(dot)jp>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: ecpg compile error on AIX
Date: 2002-01-07 16:29:05
Message-ID: 20020107162905.GB26406@feivel.credativ.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 07, 2002 at 02:27:43PM +0900, Tatsuo Ishii wrote:
> I got followings with current on AIX 5L using xlc (native AIX
> compiler):
> ...
> :
> "data.c", line 357.81: 1506-068 (S) Operation between types "void*" and "long" is not allowed.
> "data.c", line 362.90: 1506-068 (S) Operation between types "void*" and "long" is not allowed.

Argh, I was afraid something like this would happen.

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

Does it complain about all variable types?

> So the code tries to add a long value to a void *pointer, which is not
> correct since the storage unit size is unknown for void * I think. If
> the code try to do a pointer calculation, "ind" should be casted to an
> appropreate type such as char * or long * etc, depending on the logic
> of the code.

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.

The idea was to skip the rest of a struct. Let's assume you have a
struct
{
int foo;
float bar;
}

If you now read a set of tuples into an array of structs of this type you
have to calculate the address of the struct[1].foo, struct[2].foo etc. and
struct[1].bar, struct[2].bar, etc.

Michael

--
Michael Meskes
Michael(at)Fam-Meskes(dot)De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2002-01-07 16:39:35 Re: LWLock contention: I think I understand the problem
Previous Message Ryouichi Matsuda 2002-01-07 09:19:44 Re: Failure in timestamptz of JDBC of 7.2b4