This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
sizeof std::tr1::array
- From: "Aaron Graham" <atgraham at gmail dot com>
- To: libstdc++ at gcc dot gnu dot org
- Date: Tue, 23 Oct 2007 21:33:48 -0700
- Subject: sizeof std::tr1::array
This has probably been discussed before, but I can't find any information on it.
Unlike boost::array, std::tr1::array (and std::array in 4.3.x) has an
attribute-alignment on its data, which means that sizeof(the_array) is
always a multiple of 16, at least on all systems I'm currently using:
value_type _M_instance[_Nm ? _Nm : 1] __attribute__((__aligned__));
This is rather inconvenient, and somewhat unnecessary, especially on
embedded systems, since there's a nontrivial hidden cost here. I have
a harder time convincing programmers not to roll-their-own when I see
stuff like that.
Can I get an explanation please?
Thanks in advance.
Aaron