On Sep 29, 2011, at 11:40 AM, Andreas Kling wrote: > Dear WebKittens, > > I'd like to add some compile-time assertions for the sizes of various > objects. The motivation comes a patch fixing bloat in InlineBox[1]. > > There are two major problems with this: > > 1. The sizes will differ on 32- and 64-bit platforms. > 2. The sizes will differ based on compiler flags. > > One idea is to add a file that would only be built on (for example) 64-bit > Mac and then at least that bot would break if an object changes size. That's > obviously not ideal though. > > Any suggestions? :)
You could group the bits together into a struct: struct { m_foo: 1; m_bar: 1; ... } m_bits; COMPILE_ASSERT(sizeof(m_bits) <= sizeof(uint32_t), Too_many_bits); This wouldn't' be sensitive to architecture. Simon _______________________________________________ webkit-dev mailing list webkit-dev@lists.webkit.org http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev