<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 4, 2014 at 6:06 PM, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This rule does not seem to be widely followed by Clang today. Looking at Parser and Sema, many getters (0 argument functions with names matching /^get[A-Z]/) return mutable references to long-lived objects. Looking through Decl.h, things are a little different: we rarely return references, but do frequently return pointers that provide mutable access to contained objects.</blockquote>
</div><br>Yea, but I *significantly* prefer the rules I describe. =]</div><div class="gmail_extra"><br></div><div class="gmail_extra">The latter case is the one that is hard to write rules around. Sometimes, you are notionally getting a reference or a pointer, and the mutability is irrelevant. Other times, the reference or pointer present should not be exposed through a getter.</div>
</div>