ILE C/C++ Compiler Reference


argopt

>>-#pragma argopt--(--+-function_name------------+--)----------><
                      +-typedef_of_function_name-+
                      +-typedef_of_function_ptr--+
                      '-function_ptr-------------'
 
 

Description

Argument Optimization (argopt) is a pragma which may improve run-time performance. Applied to a bound procedure, optimizations can be achieved by:

Parameters

function_name
Specifies the name of the function for which optimized procedure parameter passing is to be specified. The function can be either a static function, an externally-defined function, or a function defined in the current compilation unit that will be called from outside the current compilation unit.

typedef_of_function_name
Specifies the name of the typedef of the function for which optimized procedure parameter passing is to be specified.

typedef_of_function_ptr
Specifies the name of the typedef of the function pointer for which optimized procedure parameter passing is to be specified.

function_ptr
Specifies the name of the function pointer for which optimized procedure parameter passing is to be specified.

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 is placed where the function, the function pointer, typedef of a function pointer or typedef of a function is visible (can be used) within a region of the program code called its scope. #pragma argopt scope is determined its placement in the code. An error will be issued when #pragma argopt is not within the scope of the declaration. The #pragma argopt directive can fall within file, block, or structure scope.



#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;


[ Top of Page | Previous Page | Next Page | Table of Contents ]