pointer

C compilerC++ compiler

pointer syntax

Read syntax diagramSkip visual syntax diagram#pragmapointer( typedef_name,pointer_type)

Description

Allows the use of IBM i pointer types:
  • space pointer
  • system pointer
  • invocation pointer
  • label pointer
  • suspend pointer
  • open pointer
A variable that is declared with a typedef that is named in the #pragma pointer directive has the pointer type associated with typedef_name in the directive. The <pointer.h> header file contains typedefs and #pragma directives for these pointer types. Including this header file in your source code allows you to use these typedefs directly for declaring pointer variables of these types.

Parameters

pointer_type
which can be one of:
SPCPTR
Space pointer
OPENPTR
Open pointer
SYSPTR
System pointer
INVPTR
Invocation pointer
LBLPTR
Label code pointer
SUSPENDPTR
Suspend pointer

Notes on Usage

The compiler issues a warning and ignores the #pragma pointer directive if any of the following errors occur:
  • The pointer type that is named in the directive is not one of SPCPTR, SYSPTR, INVPTR, LBLPTR, SUSPENDPTR, or OPENPTR.
  • The typedef named is not declared before the #pragma pointer directive.
  • The identifier that is named as the first parameter of the directive is not a typedef.
  • The typedef named is not a typedef of a void pointer.
  • The typedef named is used in a declaration before the #pragma pointer directive.

The typedef named must be defined at file scope.

See the ILE C/C++ Programmer's Guide for more information about using IBM i pointers.