<br><br><div class="gmail_quote">On Tue, Jul 24, 2012 at 12:47 AM, Maciej Stachowiak <span dir="ltr"><<a href="mailto:mjs@apple.com" target="_blank">mjs@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><br><div><div class="im"><div>On Jul 23, 2012, at 8:09 AM, Yury Semikhatsky <<a href="mailto:yurys@chromium.org" target="_blank">yurys@chromium.org</a>> wrote:</div><br><blockquote type="cite">
<b style="font-family:'Times New Roman';font-size:medium;font-weight:normal"><br>
<span style="vertical-align:baseline;color:rgb(34,34,34);font-size:13px;white-space:pre-wrap;font-family:Arial"></span><br><span style="vertical-align:baseline;color:rgb(34,34,34);font-size:13px;white-space:pre-wrap;font-family:Arial">First option we consider is to define a class with the same set of fields as the instrumented one, then have a compile time assert that size of the reference class equals to the size of the instrumented one. See </span><a href="https://bugs.webkit.org/attachment.cgi?id=153479&action=review" target="_blank"><span style="vertical-align:baseline;color:rgb(17,85,204);font-size:13px;white-space:pre-wrap;font-family:Arial">https://bugs.webkit.org/attachment.cgi?id=153479&action=review</span></a><span style="vertical-align:baseline;color:rgb(34,34,34);font-size:13px;white-space:pre-wrap;font-family:Arial"> for more details.</span><br>
<span style="vertical-align:baseline;color:rgb(34,34,34);font-size:13px;white-space:pre-wrap;font-family:Arial"></span><br><span style="vertical-align:baseline;color:rgb(34,34,34);font-size:13px;white-space:pre-wrap;font-family:Arial">Pros: compile time error whenever size of an instrumented class changes with the appropriate modifications to the instrumentation function.</span><br>
<span style="vertical-align:baseline;color:rgb(34,34,34);font-size:13px;white-space:pre-wrap;font-family:Arial">Cons: it will require each committer to adjust the reference class and the instrumentation on any modification that affects size of the instrumented class. Changes that don't affect size of the class will go unnoticed.</span><br>
</b></blockquote><div><br></div></div><div>What is the advantage of this approach compared to just using the sizeof operator on the relevant classes?</div><div><br></div></div></div></blockquote><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div><div>Regards,</div><div>Maciej</div><div><br></div></div></div></blockquote></div><br><div><div>Summing up sizeof type of each field and parent class and comparing it to sizeof the class would do the same thing except that we would need sometimes to manually handle alignment discrepancies on different platforms.</div>
<div> </div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div style="word-wrap:break-word">
<div></div></div></blockquote></div>