<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body text="#000000" bgcolor="#FFFFFF">
why does clang not support builtin_apply?<br>
<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<h3 class="section" style="color: rgb(0, 0, 0); font-family: 'Times
New Roman'; font-style: normal; font-variant: normal;
letter-spacing: normal; line-height: normal; orphans: auto;
text-align: start; text-indent: 0px; text-transform: none;
white-space: normal; widows: auto; word-spacing: 0px;
-webkit-text-stroke-width: 0px;">6.5 Constructing Function Calls</h3>
<p style="color: rgb(0, 0, 0); font-family: 'Times New Roman';
font-size: medium; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height: normal;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;"><a
name="index-constructing-calls-2554"></a><a
name="index-forwarding-calls-2555"></a>Using the built-in
functions described below, you can record the arguments a function
received, and call another function with the same arguments,
without knowing the number or types of the arguments.</p>
<p style="color: rgb(0, 0, 0); font-family: 'Times New Roman';
font-size: medium; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height: normal;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;">You can also
record the return value of that function call, and later return
that value, without knowing what data type the function tried to
return (as long as your caller expects that data type).</p>
<p style="color: rgb(0, 0, 0); font-family: 'Times New Roman';
font-size: medium; font-style: normal; font-variant: normal;
font-weight: normal; letter-spacing: normal; line-height: normal;
orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;">However, these
built-in functions may interact badly with some sophisticated
features or other extensions of the language. It is, therefore,
not recommended to use them outside very simple functions acting
as mere forwarders for their arguments.</p>
<div class="defun" style="color: rgb(0, 0, 0); font-family: 'Times
New Roman'; font-size: medium; font-style: normal; font-variant:
normal; font-weight: normal; letter-spacing: normal; line-height:
normal; orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;">— Built-in
Function: void *<span class="Apple-converted-space"> </span><b>__builtin_apply_args</b><span
class="Apple-converted-space"> </span>()<var><a
name="index-g_t_005f_005fbuiltin_005fapply_005fargs-2556"></a></var><br>
<blockquote>
<p>This built-in function returns a pointer to data describing
how to perform a call with the same arguments as are passed to
the current function.</p>
<p>The function saves the arg pointer register, structure value
address, and all registers that might be used to pass
arguments to a function into a block of memory allocated on
the stack. Then it returns the address of that block.</p>
</blockquote>
</div>
<div class="defun" style="color: rgb(0, 0, 0); font-family: 'Times
New Roman'; font-size: medium; font-style: normal; font-variant:
normal; font-weight: normal; letter-spacing: normal; line-height:
normal; orphans: auto; text-align: start; text-indent: 0px;
text-transform: none; white-space: normal; widows: auto;
word-spacing: 0px; -webkit-text-stroke-width: 0px;">— Built-in
Function: void *<span class="Apple-converted-space"> </span><b>__builtin_apply</b><span
class="Apple-converted-space"> </span>(<var>void<span
class="Apple-converted-space"> </span></var>(<var>*function</var>)()<var>,
void *arguments, size_t size</var>)<var><a
name="index-g_t_005f_005fbuiltin_005fapply-2557"></a></var><br>
<blockquote>
<p>This built-in function invokes<span
class="Apple-converted-space"> </span><var>function</var><span
class="Apple-converted-space"> </span>with a copy of the
parameters described by<span class="Apple-converted-space"> </span><var>arguments</var><span
class="Apple-converted-space"> </span>and<span
class="Apple-converted-space"> </span><var>size</var>.</p>
<p>The value of<span class="Apple-converted-space"> </span><var>arguments</var><span
class="Apple-converted-space"> </span>should be the value
returned by<span class="Apple-converted-space"> </span><code>__builtin_apply_args</code>.
The argument<span class="Apple-converted-space"> </span><var>size</var><span
class="Apple-converted-space"> </span>specifies the size of
the stack argument data, in bytes.</p>
<p>This function returns a pointer to data describing how to
return whatever value is returned by<span
class="Apple-converted-space"> </span><var>function</var>.
The data is saved in a block of memory allocated on the stack.</p>
<p>It is not always simple to compute the proper value for<span
class="Apple-converted-space"> </span><var>size</var>. The
value is used by<span class="Apple-converted-space"> </span><code>__builtin_apply</code><span
class="Apple-converted-space"> </span>to compute the amount
of data that should be pushed on the stack and copied from the
incoming argument area.</p>
</blockquote>
</div>
<br class="Apple-interchange-newline">
<br>
</body>
</html>