Re: ecpg compile error on AIX

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: ecpg compile error on AIX
Дата
Msg-id 9677.1010425207@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: ecpg compile error on AIX  (Michael Meskes <meskes@postgresql.org>)
Ответы Re: ecpg compile error on AIX
Список pgsql-hackers
Michael Meskes <meskes@postgresql.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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Why MemoryContextSwitch in ExecRelCheck ?
Следующее
От: Laurette Cisneros
Дата:
Сообщение: Re: bug in join?