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

From Michael Meskes
Subject Re: ecpg compile error on AIX
Date
Msg-id 20020107162905.GB26406@feivel.credativ.de
Whole thread Raw
In response to ecpg compile error on AIX  (Tatsuo Ishii <t-ishii@sra.co.jp>)
Responses Re: ecpg compile error on AIX  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!


pgsql-hackers by date:

Previous
From: Michael Meskes
Date:
Subject: Re: fork() while connected
Next
From: Holger Krug
Date:
Subject: Re: ON ERROR triggers