<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Mon, Jan 9, 2017 at 3:14 PM Daniel Berlin <<a href="mailto:dberlin@dberlin.org">dberlin@dberlin.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg"><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg">On Mon, Jan 9, 2017 at 3:06 PM, David Blaikie via llvm-dev <span dir="ltr" class="gmail_msg"><<a href="mailto:llvm-dev@lists.llvm.org" class="gmail_msg" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br class="gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg"><br class="gmail_msg"><br class="gmail_msg"><div class="gmail_quote gmail_msg"><span class="gmail_msg"><div dir="ltr" class="gmail_msg">On Mon, Jan 9, 2017 at 2:59 PM Sanjoy Das via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="gmail_msg" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br class="gmail_msg"></div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
Sorry I fat fingered an earlier send in the previous email.  I was<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
trying to say:<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
On Mon, Jan 9, 2017 at 2:52 PM, Sanjoy Das<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
<<a href="mailto:sanjoy@playingwithpointers.com" class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg" target="_blank">sanjoy@playingwithpointers.com</a>> wrote:<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
>> +1 Exactly this.<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
>> I don't think C programmer will not understand using. The "=" makes it much<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
>> simpler to read, even if it is the first time you see it, which is not the<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
>> case of typedef.<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
>><br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
>> typedef MyType::NestedType (*fptr)(const MyOhterType&);<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
>> or<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
>> using fptr = MyType::NestedType (*)(const MyOhterType&);<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
><br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
I would prefer to please keep using typedefs at least for function<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
pointers.  I find either of<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
typedef MyType::NestedType (*fptr)(const MyOhterType&);<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
or<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
typedef int fptr(const int&);<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
void f(fptr* ptr) {<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
  ...<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
}<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
easier to read than the "using" declaration (especially the second<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
form, with the explicit `fptr* ptr`).<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg"></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></span><div class="gmail_msg">Not sure I follow. You're saying this:<br class="gmail_msg"><br class="gmail_msg">  typedef int func_type(const int&);<br class="gmail_msg"><br class="gmail_msg">is easier for you to read than this:<br class="gmail_msg"><br class="gmail_msg">  using func_type = int(const int&);<br class="gmail_msg"></div></div></div></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div></div></div><div dir="ltr" class="gmail_msg"><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg">I'd say so, one looks like the functions i right. The other looks strange ;)</div></div></div></div></blockquote><div><br>Fair enough<br><br>(though mostly (going by a quick grep) we end up with (a very rough guess, looking at a grep over llvm - maybe 20 times more common than function typedefs):<br><br>  typedef void (*fptr)(const int&);<br><br>which is a bit more arcane & perhaps easier as:<br><br>  using fptr = void (*)(const int&);<br><br>Then you don't have to try to remember where the variable name goes in these weird declarations - it's still pretty ugly, admittedly)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg"><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg"> </div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg"><br class="gmail_msg">?</div><span class="gmail_msg"><div class="gmail_msg"> </div><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
-- Sanjoy<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
_______________________________________________<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
LLVM Developers mailing list<br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
<a href="mailto:llvm-dev@lists.llvm.org" class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg" target="_blank">llvm-dev@lists.llvm.org</a><br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="m_167062546753346678m_1741477346931537050gmail_msg gmail_msg">
</blockquote></span></div></div>
<br class="gmail_msg">_______________________________________________<br class="gmail_msg">
LLVM Developers mailing list<br class="gmail_msg">
<a href="mailto:llvm-dev@lists.llvm.org" class="gmail_msg" target="_blank">llvm-dev@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br class="gmail_msg">
<br class="gmail_msg"></blockquote></div></div></div></blockquote></div></div>