Обсуждение: Bool values under Mac OS X

Поиск
Список
Период
Сортировка

Bool values under Mac OS X

От
lothar.behrens@lollisoft.de
Дата:
Hi,

I have detected problems with bool values under Mac OS X.
Even configuring TrueIsMinus1=1 does not help.

My conversion is these:

bool b = *(bool*) buffer;

Where the buffer is an allocated space on heap to be bound as culumn.
If I use BoolsAsChar=1 I get values from 0 to 1.

The values are the same as under Windows.

Any help ?

Thanks

Lothar

--
Lothar Behrens        www.lollisoft.de
Rosmarinstr 3        My public project:
40235 Düsseldorf      http://sourceforge.net/projects/lbdmf




Re: Bool values under Mac OS X

От
Tom Lane
Дата:
lothar.behrens@lollisoft.de writes:
> My conversion is these:
> bool b = *(bool*) buffer;

What's the data type of "buffer"?

On Intel hardware the above will fetch the low-order byte of "buffer",
but on PPC (and other big-endian) hardware, it will fetch the high-order
byte.  I suspect strongly that your problem has nothing to do with OS X
versus Windows and everything to do with being careless about endianness
issues.

            regards, tom lane

Re: Bool values under Mac OS X

От
lothar.behrens@lollisoft.de
Дата:
Am 26 Apr 2005 um 10:24 hat Tom Lane geschrieben:

> lothar.behrens@lollisoft.de writes:
> > My conversion is these:
> > bool b = *(bool*) buffer;
>
> What's the data type of "buffer"?
>

void*

> On Intel hardware the above will fetch the low-order byte of "buffer",
> but on PPC (and other big-endian) hardware, it will fetch the high-order
> byte.  I suspect strongly that your problem has nothing to do with OS X
> versus Windows and everything to do with being careless about endianness
> issues.

I have tried out ByteAsChar and got 0 or 1. Then I have done an int conversion
instead of bool. Then I got it working. 0 is false and all other values threaded true.

Lothar

>
>             regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq
>


--
Lothar Behrens        www.lollisoft.de
Rosmarinstr 3        My public project:
40235 Düsseldorf      http://sourceforge.net/projects/lbdmf