OS/2, eCS & ArcaOS - Technical > Programming

Function MACRO or #DEFINE?

<< < (2/2)

Dariusz Piatkowski:
You know, to complicate things further, even the IBMCPP 3.6.5 docs sometimes intermittently change the descriptions of what's a MACRO and what's a STATIC define, for example:

in reference to the following source contained in STDIO.H:


--- Code: ---...
#define _IOFBF              1   /* Buffer modes */
   #define _IOLBF              2
   #define _IONBF              3
   #define BUFSIZ           4096   /* Default buffer size */
   #define EOF              (-1)
   #define L_tmpnam          260   /* Maximum length of temporary names */
   #define FOPEN_MAX          20   /* Minimum number of open files guaranteed */
   #define FILENAME_MAX      260   /* Maximum file name length */
   #define SEEK_SET            0   /* fseek constants */
   #define SEEK_CUR            1
   #define SEEK_END            2
   #define TMP_MAX        100000   /* Maximum guaranteed unique file names */

   #define _IOEOF         0x0001   /* EOF flag mask */
   #define _IOERR         0x0002   /* ERR flag mask */
...

--- End code ---

the HTML docs actually state the following:


--- Quote ---...The macros SEEK_CUR, SEEK_END, and SEEK_SET expand to integral constant expressions and can be used as the third argument to fseek.

The macros _IOFBF, _IOLBF, and _IONBF expand to integral constant expressions with distinct values suitable for use as the third argument to the setvbuf function...
--- End quote ---

Clearly, these #define statements all point to a real value, none of these have even a simple +/- type of a calculation in them...sigh!

Navigation

[0] Message Index

[*] Previous page

Go to full version