Here's something I coded to try things out. Should we print function parameter types the way we do right now or should we do it like gcc (printing template parameter names instead of real type names)?<div><br></div><div>

gcc:</div><div>const char* foo(T) [with T = int] </div><div><br></div><div>msvc:</div><div>const char *__cdecl foo<int>(int)</div><div><br></div><div>clang:</div><div>const char *foo(int)</div><div><br></div><div>clang + patch:</div>

<div>const char* foo(int) [T = int]
</div><div><br></div><div>potential formatting (gcc msvc hybrid):</div><div>const char *foo<T = int>(T)</div><div><br></div><div>What do you think?</div><div><br><div class="gmail_quote">On Thu, Dec 1, 2011 at 4:07 PM, Douglas Gregor <span dir="ltr"><<a href="mailto:dgregor@apple.com">dgregor@apple.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
On Nov 30, 2011, at 9:03 PM, Eli Friedman wrote:<br>
<br>
> On Wed, Nov 30, 2011 at 8:45 PM, Joerg Sonnenberger<br>
> <<a href="mailto:joerg@britannica.bec.de">joerg@britannica.bec.de</a>> wrote:<br>
>> On Wed, Nov 30, 2011 at 06:21:04PM -0800, Kostya Serebryany wrote:<br>
>>> #include <stdio.h><br>
>>> template<class T><br>
>>> const char *foo() {<br>
>>>   return __PRETTY_FUNCTION__;<br>
>>> }<br>
>>> int main() {<br>
>>>   printf("%s\n", foo<int>());<br>
>>> }<br>
>><br>
>> This gets more interesting if the template is actually used by the<br>
>> function. Changing it to foo(T x) and adjusting the call, the result is:<br>
>><br>
>> clang:<br>
>> const char *foo(int)<br>
>><br>
>> gcc:<br>
>> const char* foo(T) [with T = int]<br>
>><br>
>> I don't think the GCC output is really better.<br>
><br>
> It's worth noting that clang's output is actually ambiguous in some<br>
> cases at the moment: you can't tell the difference between "void<br>
> f(int)" and "template<typename T> void f(T)" with T=int.<br>
<br>
<br>
</div>Right. For this reason, I like GCC's output better (except that the '*' is in the wrong place <g>).<br>
<br>
        - Doug<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
</div></div></blockquote></div><br></div>