On Tue, May 14, 2013 at 5:47 PM, Aaron Ballman <span dir="ltr"><<a href="mailto:aaron@aaronballman.com" target="_blank">aaron@aaronballman.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Tue, May 14, 2013 at 8:42 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:<br>
> On Tue, May 14, 2013 at 5:41 PM, Aaron Ballman <<a href="mailto:aaron@aaronballman.com">aaron@aaronballman.com</a>><br>
> wrote:<br>
>><br>
>> On Tue, May 14, 2013 at 8:34 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>><br>
>> wrote:<br>
>> > On Tue, May 14, 2013 at 4:07 PM, Charles Davis <<a href="mailto:cdavis5x@gmail.com">cdavis5x@gmail.com</a>><br>
>> > wrote:<br>
>> >><br>
>> >><br>
>> >> On May 14, 2013, at 4:26 PM, Aaron Ballman wrote:<br>
>> >> ><br>
>> >> >> Do __sptr and __uptr get different manglings?<br>
>> >> ><br>
>> >> > They do:<br>
>> >> ><br>
>> >> > void func( int * __ptr32 p ) {}<br>
>> >> > void func2( int * __ptr64 p ) {}<br>
>> >> ><br>
>> >> > PUBLIC ?func@@YAXPAH@Z ; func<br>
>> >> > PUBLIC ?func2@@YAXPEAH@Z ; func2<br>
>> >> ><br>
>> >> > Namely, the presence of E (rnk pointed this out previously).<br>
>> >> He was asking about __sptr and __uptr :). They don't by the way:<br>
>> >><br>
>> >> > cl /c test.cpp<br>
>> >> [extraneous banner output omitted]<br>
>> >> > dumpbin /symbols test.obj<br>
>> >> [...]<br>
>> >> 00F 00000010 SECT4  notype ()    External     | ?func@@YAXPAH@Z (void<br>
>> >> __cdecl func(int *))<br>
>> >> 010 00000020 SECT4  notype ()    External     | ?func2@@YAXPAH@Z (void<br>
>> >> __cdecl func2(int *))<br>
>> ><br>
>> ><br>
>> > Thanks. One more thing:<br>
>> ><br>
>> > template<typename T> void f(void **p, T *q) { *p = *q; }<br>
>> ><br>
>> > void *g(int *__ptr32 __sptr a) {<br>
>> >   void *result;<br>
>> >   f(&result, &a);<br>
>> >   return result;<br>
>> > }<br>
>> > void *h(char *__ptr32 __uptr a) {<br>
>> >   void *result;<br>
>> >   f(&result, &a);<br>
>> >   return result;<br>
>> > }<br>
>> ><br>
>> > int main() {<br>
>> >   printf("%p\n", g((int *__ptr32 __sptr)0xdeadbeef));<br>
>> >   printf("%p\n", h((char *__ptr32 __uptr)0xdeadbeef));<br>
>> > }<br>
>> ><br>
>> > Does one of these get sign-extended and the other one get zero-extended?<br>
>><br>
>> The first is sign extended, and the second is zero extended in 64-bit.<br>
><br>
><br>
> What happens if you change the two 'char's to 'int's?<br>
<br>
</div></div>Both sign extend.  Is that due to the template instantiation?</blockquote><div><br></div><div>Yeah, both are instantiated with canonically-equivalent arguments. That is madness, and we shouldn't support it unless we have a strong compatibility argument to do so. Can we get away with rejecting __uptr and ignoring __sptr?</div>
</div>