开发者

__builtin_apply 's size argument for constructing call in gcc?

i would like to play with the constructing calls feature of gcc...

From the doc :

— Built-in Function:

void * __builtin_apply (void (*function)(), void *arguments, size_t size)

This built-in function invokes function with a copy of the parameters described by arguments and size.

The value of arguments should be the value returned by __builtin_apply_开发者_Python百科args. The argument size specifies the size of the stack argument data, in bytes.

This function returns a pointer to data describing how to return whatever value was returned by function. The data is saved in a block of memory allocated on the stack.

It is not always simple to compute the proper value for size. The value is used by __builtin_apply to compute the amount of data that should be pushed on the stack and copied from the incoming argument area.

My question is how to know what size to give to this size argument ? And what are the consequences if the value is too small or too large ?

Thanks...


Based on the code snippets I found via google, I would say that the size value is not something you can directly compute without more platform specific information (or at least knowing the calling convention). If the size is too small, then you won't pass enough arguments on the stack and the function will do something unspecified. If the size is too large, then you'll just use up unnecessary stack space.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜