<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>Le 18 déc. 2011 à 15:38, Nikola Smiljanic a écrit :</div><br class="Apple-interchange-newline"><blockquote type="cite">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></blockquote><div><br></div>This form is ambiguous. You don't know which argument use the template type.</div><div><br></div><div>For example, if foo were declared like that:</div><div>int foo(T x, int y);</div><div><br></div><div>you will get:</div><div>int foo(int x, int y) [T = int]</div><div><br></div><div><br><blockquote type="cite"><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>
<span><pretty_function.patch></span>_______________________________________________<br>cfe-dev mailing list<br><a href="mailto:cfe-dev@cs.uiuc.edu">cfe-dev@cs.uiuc.edu</a><br>http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev<br></blockquote></div><br><div>
<span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div>-- Jean-Daniel</div><div><br></div><div><br></div></span><br class="Apple-interchange-newline">
</div>
<br></body></html>