<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On May 23, 2012, at 12:58 AM, Tom Care wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><blockquote type="cite"><div><br>class->method() //; escapes, unless method is const?<br></div></blockquote><br><blockquote type="cite"><div>bar(); // escapes - conservative - bar may have class pointer</div></blockquote><br><div>I am not following this one. If 'bar()' is just any function, how does it have 'class' pointer? Is 'class' global?</div></div></div></div></blockquote><div><br></div><div>I was a bit vague here. My point was that by taking the conservative view, 'bar' may have had access to 'class' at some point and retained the pointer. </div></div></div></div></blockquote><div><br></div><div>Are you assuming class is a global here? </div></div><div><br></div><div><div>If 'class' is a local, I don't see how 'bar' can modify it. </div><div>If 'class' is a global and we don't know anything about bar(), we should assume that the pointer escapes.<br></div></div><div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><div>It may not even respect constness (due to a const cast) or field visibility (friend class/function) etc. Without doing more interprocedural analysis or having a complete view of the code, it would be hard to make assumptions without leading to false positives.</div></div></div></div></blockquote></div><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><br><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><div><br></div><blockquote type="cite"><div>Tom<br><br>_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br></div></blockquote></div><br></div></div></blockquote></div><br></div></div></blockquote></div><br></body></html>