<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 13, 2014 at 4:00 PM, Chris Lattner <span dir="ltr"><<a href="mailto:clattner@apple.com" target="_blank">clattner@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Oct 13, 2014, at 3:44 PM, Chandler Carruth <<a href="mailto:chandlerc@google.com">chandlerc@google.com</a>> wrote:<br>
> I actually have a particular allergy to member variable names and function names having similar styles:<br>
><br>
> bool x = i->isMyConditionTrue;<br>
><br>
> Did I mean to write 'isMyConditionTrue()'? Or 'bool &x = I->isMyConditionTrue'? Or something else? I have no idea. Warnings and other things can help reduce the likelihood of this becoming a live bug, but it still makes the code harder to read IMO.<br>
<br>
</span>This is exactly why I was making the wishy-washy statement about instance variables.  This is the pattern that I tend to prefer:<br>
<br>
<br>
class Something {<br>
  bool IsMyConditionTrue;<br>
<br>
…<br>
<br>
  bool isMyConditionTrue() const { return IsMyConditionTrue; }<br>
}<br>
<br>
If you make instance variables be lower camel case, then you get serious conflict between ivars and methods.  Doing this also deflates some of the ammunition used by advocates of _ for ivars :-)<br></blockquote><div><br></div><div>trailing or leading _ for ivars seem to be a common practice. What is the reason it s not used in LLVM?</div><div><br></div><div>David</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class="HOEnZb"><font color="#888888"><br>
-Chris<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br></div></div>