<div dir="ltr"><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.</blockquote></div><br>Agreed.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I am also fine with:</div><div class="gmail_extra"><br></div><div class="gmail_extra">class Something {</div><div class="gmail_extra"> bool is_my_condition_true;</div><div class="gmail_extra"><br></div><div class="gmail_extra">...</div><div class="gmail_extra"><br></div><div class="gmail_extra"> bool isMyConditionTrue() const { return is_my_condition_true; }</div><div class="gmail_extra">};</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">I think it has the same lack of ambiguity. Its somewhat nicer that there is no type name conflict as well, but honestly that's a smaller gain IMO.</div></div>