<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Sep 15, 2008, at 6:35 PM, Zhongxing Xu wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><br><br><div class="gmail_quote">2008/9/16 Ted Kremenek <span dir="ltr"><<a href="mailto:kremenek@apple.com">kremenek@apple.com</a>></span><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div class="Ih2E3d"><br> On Sep 7, 2008, at 1:32 AM, Zhongxing Xu wrote:<br> <br> </div><div><div></div><div class="Wj3C7c"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Hi,<br> <br> In RewriteRope.cpp, RewriteRope::MakeRopeString(const char *Start, const char *End),<br> we calculate the AllocSize by:<br> <br> unsigned AllocSize = sizeof(RopeRefCountString) - 1 + AllocChunkSize;<br> <br> I guess here the intention is: sizeof(RopeRefCountString) is 5. But gcc says sizeof(RopeRefCountString) is 8. So the actual AllocSize is 4087. Should we minus 4 instead of 1 to make the AllocSize 4084?<br> </blockquote> <br></div></div> The "-1" I believe is to accommodate for the field Data[1], which occupies a single byte:<br> </blockquote><div><br>In practice it occupies 4 bytes because of tail padding. <br></div></div></div></blockquote></div><br><div>Right.  Isn't there a pointer arithmetic trick we can do here to get the right number?</div><div><br></div></body></html>