<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Nov 9, 2009, at 4:20 PM, Zhongxing Xu wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span class="Apple-style-span" style="border-collapse: separate; font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; ">2009/11/10 Ted Kremenek <<a href="mailto:kremenek@apple.com">kremenek@apple.com</a>>:<br><blockquote type="cite">Hi Zhongxing,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">I think the previous wording was more in the right direction as it explained<br></blockquote><blockquote type="cite">the actual problem; "This can produce an unexpected result." is fairly<br></blockquote><blockquote type="cite">content-free unless you already know what the warning is about.<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">How about:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"> "Call to sizeof() returns the size of the pointer (X bytes) instead of how<br></blockquote><blockquote type="cite">much memory has been allocated by malloc()"<br></blockquote><br>I think sizeof() never return the memory allocated by malloc(). (CWE<br>is misleading) sizeof only returns the size of the object represented<br>by the expression.</span></blockquote></div><br><div>Right.  I think the CWE is inspired by people taking the sizeof an array or some buffer and think that it's getting the actual size.  That fact that it gets the sizeof the pointer is what confuses many people.</div></body></html>