<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2017-01-09 19:25 GMT+01:00 Mehdi Amini <span dir="ltr"><<a href="mailto:mehdi.amini@apple.com" target="_blank">mehdi.amini@apple.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div style="word-wrap:break-word"><div><div class="gmail-h5"><br><div><blockquote type="cite"><div>On Jan 9, 2017, at 10:20 AM, Reid Kleckner via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="gmail-m_-908706384169950010Apple-interchange-newline"><div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jan 9, 2017 at 7:25 AM, Piotr Padlewski via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span>2017-01-09 16:15 GMT+01:00 Renato Golin <span dir="ltr"><<a href="mailto:renato.golin@linaro.org" target="_blank">renato.golin@linaro.org</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 9 January 2017 at 14:17, Piotr Padlewski via cfe-dev<br>
<span><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>> wrote:<br>
> - prefer "using' instead of "typedef"<br>
> - use default member initialization<br>
</span><span>> - use default, override, delete<br>
> - skip "virtual" with override<br>
<br>
</span>I thought we had all of those already...<br>
<span><br></span></blockquote></span><div>Nope, some people use it, but I still see a lot of new code with typedefs.</div><div>I would like to have it written in style guide so it will be easier to convince to change in review.</div></div></div></div></blockquote><div><br></div><div>The last two are enforced by compiler warnings now. The second is hard because of bitfields.</div><div><br></div><div>I object to the first. If you need a new type name, use a typedef. It's time honored and everyone, including C programmers, will know what you're doing. I don't understand why people push the new thing just for the sake of new-ness. </div></div></div></div></div></blockquote></div><br></div></div><div>`using` handles strictly more cases than `typedef`, in particular partial specialization of templates. So because we’ll end up with `using` anyway, uniformity can be valuable. So that could be a motivation: since `using` is needed anyway, might be better to just use it always (I’m not saying it is a “strong” motivation though, just some piece of rational). </div><div>(I also find that typedef of function pointers in particular are terrible, and `using` is much better for these, but that can be a matter of taste).</div><div><br></div><div>—</div><span class="gmail-HOEnZb"><font color="#888888"><div>Mehdi</div></font></span></div></blockquote></div><br></div><div class="gmail_extra">+1 Exactly this. </div><div class="gmail_extra">I don't think C programmer will not understand using. The "=" makes it much simpler to read, even if it is the first time you see it, which is not the case of typedef. </div><div class="gmail_extra"><br></div><div class="gmail_extra">typedef MyType::NestedType (*fptr)(const MyOhterType&);</div><div class="gmail_extra">or</div><div class="gmail_extra">using fptr = MyType::NestedType (*)(const MyOhterType&);</div><div class="gmail_extra"><br></div><div class="gmail_extra">Typedefs with function pointers are used in couple of places in LLVM and I find it terible to read.</div><div class="gmail_extra"><br></div><div class="gmail_extra">So it is not about new-ness. Trust me, I would never use typedef if using was first :)</div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div></div>