argopt syntax >>-#pragma argopt--(--+-function_name------------+--)---------->< +-typedef_of_function_name-+ +-typedef_of_function_ptr--+ '-function_ptr-------------'
Description
Argument Optimization (argopt) is a pragma which might improve run-time performance. Applied to a bound procedure, optimizations can be achieved by:
Parameters
Notes on Usage
Specifying #pragma argopt directive does not guarantee that your program will be optimized. Participation in argopt is dependent on the translator.
Do not specify #pragma argopt together with #pragma descriptor for the same declaration. The compiler supports using only one or the other of these pragmas at a time.
A function must be declared (prototyped), or defined before it can be named in a #pragma argopt directive.
Void pointers will not be optimized since they are not space pointers.
Use of #pragma argopt is not supported in struct declarations.
The #pragma argopt cannot be specified for functions which have OS-linkage or built-in linkage (for functions which have a #pragma linkage (function_name, OS) directive or #pragma linkage(function_name, builtin) directive associated with them, and vice versa).
The #pragma argopt will be ignored for functions which are named as handler functions in #pragma exception_handler or #pragma cancel_handler directives, and error handling functions such as signal() and atexit(). The #pragma argopt directive cannot be applied to functions with a variable argument list.
#pragma argopt scoping
The #pragma argopt must be placed in the same scope as the function, the function pointer, typedef of a function pointer, or typedef of a function that it operates on. If the #pragma argopt is not in the same scope, an error is issued.
#include <stdio.h>
long func3(long y)
{
printf("In func3()\n");
printf("hex=%x,integer=%d\n",y, y);
}
#pragma argopt (func3) /* file scope of function */
int main(void)
{
int i, a=0;
typedef long (*func_ptr) (long);
#pragma argopt (func_ptr) /* block scope of typedef */
/* of function pointer */
struct funcstr
{
long (*func_ptr2) (long);
#pragma argopt (func_ptr2) /* struct scope of function */
/* pointer */
};
struct funcstr func_ptr3;
for (i=0; i<99; i++)
{
a = i*i;
if (i == 7)
{
func_ptr3.func_ptr2( i );
}
}
return i;
}