<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2017-01-11 10:44 GMT+01:00 Sean Silva <span dir="ltr"><<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Tue, Jan 10, 2017 at 8:49 AM, Sanjoy Das via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-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="auto"><div><br><br><div>Sent from a mobile device, please excuse typos.</div><div><div class="m_-2875193246733191067gmail-h5"><div class="gmail_extra"><br><div class="gmail_quote">On Jan 10, 2017 2:04 AM, "Piotr Padlewski" <<a href="mailto:piotr.padlewski@gmail.com" target="_blank">piotr.padlewski@gmail.com</a>> wrote:<br type="attribution"><blockquote class="m_-2875193246733191067gmail-m_2296032500109650196quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><div class="m_-2875193246733191067gmail-m_2296032500109650196elided-text">2017-01-10 0:06 GMT+01:00 David Blaikie <span dir="ltr"><<a href="mailto:dblaikie@gmail.com" target="_blank">dblaikie@gmail.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 dir="ltr"><br><br><div class="gmail_quote"><span class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-"><div dir="ltr">On Mon, Jan 9, 2017 at 2:59 PM Sanjoy Das via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
Sorry I fat fingered an earlier send in the previous email.  I was<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
trying to say:<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
On Mon, Jan 9, 2017 at 2:52 PM, Sanjoy Das<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
<<a href="mailto:sanjoy@playingwithpointers.com" class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg" target="_blank">sanjoy@playingwithpointers.co<wbr>m</a>> wrote:<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
>> +1 Exactly this.<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
>> I don't think C programmer will not understand using. The "=" makes it much<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
>> simpler to read, even if it is the first time you see it, which is not the<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
>> case of typedef.<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
>><br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
>> typedef MyType::NestedType (*fptr)(const MyOhterType&);<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
>> or<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
>> using fptr = MyType::NestedType (*)(const MyOhterType&);<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
><br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
I would prefer to please keep using typedefs at least for function<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
pointers.  I find either of<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
typedef MyType::NestedType (*fptr)(const MyOhterType&);<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
or<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
typedef int fptr(const int&);<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
void f(fptr* ptr) {<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
  ...<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
}<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
easier to read than the "using" declaration (especially the second<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
form, with the explicit `fptr* ptr`).<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg"></blockquote><div><br></div></span><div>Not sure I follow. You're saying this:<br><br>  typedef int func_type(const int&);<br><br>is easier for you to read than this:<br><br>  using func_type = int(const int&);<br><br>?</div><div> </div></div></div></blockquote></div><div>I never saw syntax</div><div><br></div><div>typedef int funct_type(const int&);</div><div><br></div><div>I tried to use it and I got compile error for code:</div><div><div>int z(const int&);</div><div><br></div><div>int main() {</div><div>    typedef int fptr(const int&);</div><div><br></div><div>    fptr f = z;</div></div></div></div></div></blockquote></div></div></div></div></div><div dir="auto"><br></div><div dir="auto">That needs to be fptr* f = z;</div></div></blockquote><div><br></div></div></div></div></div></div></blockquote><div>That make sense!</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><div class="h5"><div></div></div></div><div>Yeah. It was confusing in the original example to have "ptr" in the name of the typedef. Usually it is more like:</div><div><br></div><div>typedef int callback_func(void *closure);</div><div>int foo(callback_func *cb) {</div><div>  // ...<br>}</div><div><br></div><div>(though this style is pretty rare in my experience, and results in the callback_func name being a weird type that you can't assign or do other stuff with).</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>-- Sean Silva</div><div> </div></font></span></div></div></div></blockquote><div><br></div><div>Yep, I have never seen it in LLVM code.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class=""><div dir="auto"><span class="m_-2875193246733191067gmail-"><div dir="auto"><br></div><div dir="auto"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="m_-2875193246733191067gmail-m_2296032500109650196quote" 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"><div><div>    f(42);</div><div>}</div></div><div><br></div><div>where typedef int (*fptr)(const int&)</div><div><br></div><div>works. </div><div class="m_-2875193246733191067gmail-m_2296032500109650196quoted-text"><div><br></div><div> </div><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_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
-- Sanjoy<span class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-"><br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
______________________________<wbr>_________________<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
LLVM Developers mailing list<br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
<a href="mailto:llvm-dev@lists.llvm.org" class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg" target="_blank">llvm-dev@lists.llvm.org</a><br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br class="m_-2875193246733191067gmail-m_2296032500109650196m_1970910203819032046gmail-m_1549861667330785639gmail_msg">
</span></blockquote></div></div>
</blockquote></div></div><br></div></div>
</blockquote></div><br></div></div></span></div>
<br></span><span class="">______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></span></blockquote></div><br></div></div>
</blockquote></div><br></div></div>