some questions ..._(re)

Mon, 23 Sep 1996 15:14:27 +0200


At 11:15 PM 9/22/96 +0200, you wrote:
>Hi Sven, hi everybody,
Hello :)
>
>
>> Why is the boolean type internal so big (Integer) ?
>
>I could not reproduce this bug.  Var B: Boolean; writeln ( Sizeof ( B ) )
>yields 1 on my machine.
>
>> Boolean should only use a bit - yes thats stupid,
>

This is not so stupid. A 32bit CPU accesses memory in 32bit chunks. It is
possible to access a byte, but this is considerably slower. Accessing a bit
would require accessing a 32bit word first, then bitshifting. All compilers
make this speed v.s. memory-consumption tradeof in favor of speed, and GPC
is no exception.

For a 64 bit CPU, it's even worse: 63bits per boolean are "waisted".

JanJaap
--
     The latest & greates in software, hardware and manswear
                       -- Bono Vox (U2)


JanJaap van der Heijden (J.J.vanderHeijden@driene.student.utwente.nl)

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es