<div style="font-family: arial, helvetica, sans-serif"><font size="2"><div class="gmail_quote">On Sun, Jun 17, 2012 at 3:48 AM, Gabor Greif <span dir="ltr"><<a href="mailto:gabor@mac.com" target="_blank">gabor@mac.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Candler wrote:<br>
<br>
> ...<br>
> +  EXPECT_EQ(sizeof(char), sizeof<br>
> (AlignedCharArray<char>::union_type));<br>
> +  EXPECT_EQ(sizeof(char[1]), sizeof(AlignedCharArray<char[1]<br>
> >::union_type));<br>
> +  EXPECT_EQ(sizeof(char[2]), sizeof(AlignedCharArray<char[2]<br>
> >::union_type));<br>
> +  EXPECT_EQ(sizeof(char[3]), sizeof(AlignedCharArray<char[3]<br>
> >::union_type));<br>
> +  EXPECT_EQ(sizeof(char[4]), sizeof(AlignedCharArray<char[4]<br>
> >::union_type));<br>
> +  EXPECT_EQ(sizeof(char[5]), sizeof(AlignedCharArray<char[5]<br>
> >::union_type));<br>
> ...<br>
<br>
<br>
And to save all other people's sanity ;-) you could introduce a macro<br>
like this:<br>
<br>
#define EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(A) \<br>
     EXPECT_EQ(sizeof(A), sizeof(AlignedCharArray<A>::union_type))<br>
<br>
and then<br>
<br>
EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(char)<br>
EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(char[1])<br>
EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(char[2])<br>
EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(char[3])<br>
EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(char[4])<br>
EXPECT_SAME_SIZEOF_WITH_AlignedCharArray(char[5])<br></blockquote><div><br></div><div>This doesn't seem to really save anything. Same number of lines of code, etc. My editor is very good at managing these blobs of text... ;]</div>
</div></font></div>