This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Conversion to bool.


Hello.
I come to this thing. I know that bools are actually stored as bytes (except stl where they are packed) but logicaly
they are single bits. Shouldn't then assignment of whatever nonnull to bool be always 1?

And also shouldn't
bool b = *(bool*)&number;
copy only the lowest bit of number?

Just an idea...

---
Jan Ringoš, Tringi@Mx-3.cz
http://Tringi.Mx-3.cz
n.v.t. MX-3, www.mx-3.cz


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]