<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On May 22, 2011, at 8:49 PM, Wenhan Gu wrote:</div><blockquote type="cite"><div>I know __builtin_va_list is target-specific, and</div><div>ARM has <span class="Apple-style-span" style="color: rgb(0, 32, 128); font-family: Fixed, monospace; font-size: 13px; white-space: pre; ">typedef void* __builtin_va_list;</span></div>
<div><font class="Apple-style-span" color="#002080" face="Fixed, monospace"><span class="Apple-style-span" style="white-space: pre;"><span class="Apple-style-span" style="font-family: arial; white-space: normal; ">X86 has <span class="Apple-style-span" style="color: rgb(0, 32, 128); font-family: Fixed, monospace; font-size: 13px; white-space: pre; ">typedef char* __builtin_va_list;</span></span><br>
</span></font><br></div><div>It seems they can be treated as the same prototype,i.e.. void*, at the header level.</div><div>What I want to ask is:</div><div>
<br></div><div>If I write a program use "typedef <b><font class="Apple-style-span" color="#ff0000">void</font></b>* __builtin_va_list" on X86, and run it.</div><div>Would I face any problem on run-time?</div></blockquote><div><br></div>C guarantees that void* and char* have compatible representations, so</div><div>as long that's the only difference, you won't have runtime problems.</div><div>You can obviously have compile-time problems, though: for example,</div><div>in C, if va_list is a void*, then it can be implicitly converted to any pointer</div><div>type instead of (as with char*) only explicitly converted; and in C++, you</div><div>can get different manglings, which is actually how we found out that our</div><div>ARM target was misdeclaring it. But otherwise it should be fine, as long</div><div>as that's the only difference.</div><div><br></div><div>However, other targets may have more complicated differences than</div><div>just void* vs. char*.</div><div><br></div><div>John.</div></body></html>