__parmdwords -- Get Number of dwords in Parameter List (OS/2)

Format

#include <stdlib.h>  /* also in <builtin.h> */
unsigned char __parmdwords(void);

Language Level: Extension
The __parmdwords function returns the hidden parameter passed in the AL register for _System linkage calls. The hidden parameter contains the size of the parameter list that is passed to the function containing the call to __parmdwords. The size is in doublewords (dwords), and can be between 0 and 255. If the parameter list is larger than 255 dwords, the hidden parameter contains the 8 least significant bits of the value.

Note: To use __parmdwords, you must compile with the /Gp+ option to include the support for it.

This function allows the implementer of a function to increase the number of parameters the function takes without changing the name of the function. The new version of the function can call __parmdwords to check the size of the parameter list and determine whether the call was written for the earlier version of the function or for the extended version.

Warning! The __parmdwords function has several limitations:

  1. Because it is a built-in function and has no backing code in the library:
  2. The __parmdwords function can only be used for functions with the _System linkage type. If you use it with other linkage types, an error message is generated, and your program will not compile correctly.
  3. Not all vendors implement the hidden parameter in the AL register, so __parmdwords may have incorrect results when you use it in a function that is called from code compiled by other compilers.

Return Value
The __parmdwords function returns the size of the parameter list passed to the function in units of dwords.

Example



Calling Conventions


<stdlib.h>
/Gp compiler option