[LLVMdev] [cfe-dev] C++11 reverse iterators (was C++11 is here)

Chandler Carruth chandlerc at google.com
Tue Mar 4 18:14:32 PST 2014


On Tue, Mar 4, 2014 at 6:06 PM, Richard Smith <richard at metafoo.co.uk> wrote:

> 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.


Yea, but I *significantly* prefer the rules I describe. =]

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140304/a5f3d7f4/attachment.html>


More information about the llvm-dev mailing list