argopt

C compiler C++ compiler
Read syntax diagramSkip visual syntax diagramargopt 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

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 is 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 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;
}              


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