Re: [ROOT] Should Bool_t still be typedef'ed to unsigned char

From: Walter F.J. Mueller (W.F.J.Mueller@gsi.de)
Date: Tue Nov 27 2001 - 13:11:34 MET


Reiner Rohlfs wrote:
> That means Bool_t will change from a type of size 1 byte to a type of size 4
> byte (at least on SUN). Isn't that a problem when I will read ROOT files which
> were created with an old version?

It is true that the memory representation of objects will change because
usually sizeof(bool) == sizeof(int). However the external representation
in a ROOT file depends on what is implemented in

	TBuffer  &operator<<(bool b);
	TBuffer  &operator>>(bool b);

and that should clearly represent a bool externally as a single byte.

A more subtle problem is that currently there is no TBuffer::operator<<(bool b)
and that streams use

      	R__b >> (Int_t&)fbool;
	R__b << (Int_t)fbool;

to stream a `bool'. That means that currently a bool is indeed 4 byte on a ROOT
file. So the implementation of my proposal needs the same tricky as the fix of
the Long_t external representation after 3.00.06.


			Cheers,	Walter 

--
Walter F.J. Mueller   Mail:  W.F.J.Mueller@gsi.de
GSI,  Abteilung KP3   Phone: +49-6159-71-2766
D-64291 Darmstadt     FAX:   +49-6159-71-2989
WWW:   http://www-kp3.gsi.de/www/kp3/people/mueller.html



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:51:09 MET