[Boost-bugs] [Boost C++ Libraries] #7659: sizeof(tribool) > sizeof(bool) * 2

Subject: [Boost-bugs] [Boost C++ Libraries] #7659: sizeof(tribool) > sizeof(bool) * 2
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-11-07 17:23:32

#7659: sizeof(tribool) > sizeof(bool) * 2
 Reporter: anonymous | Owner: dgregor
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: logic
  Version: Boost 1.52.0 | Severity: Optimization
 Keywords: |
 I was wondering why tribool is 4 times larger than a simple bool (tested
 with msvc10 in 32bit and g++ 4.6.2 on 64bit). By looking at the sourcecode
 I am suspecting the internal enum always gets compiled as a 4byte int.
 When using the similar boost::optional<bool> I get at least as good as the
 naive implementation using two bools, but actually I was expecting a class
 tribool to be sizeof(bool) *and* encode the third value in the 7 unused
 bits of the single bool member field.

 If this has been a design decision I think this is a decision that should
 be documented.

Ticket URL: <https://svn.boost.org/trac/boost/ticket/7659>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:11 UTC