H2INC translates variables from C to MASM format. For example, this C declaration
int my_var;
is translated into the MASM declaration
EXTERNDEF my_var:SWORD
H2INC converts C variable types to MASM types as follows:
C Type | MASM Type | |
char | BYTE or SBYTE (controlled by /J option) | |
signed char | SBYTE | |
unsigned char | BYTE | |
short | SWORD | |
unsigned short | WORD | |
int | SWORD (SDWORD with /G3 or /G4 option) | |
unsigned int | WORD (DWORD with /G3 or /G4 option) | |
long | SDWORD | |
unsigned long | DWORD | |
float | REAL4 | |
double | REAL8 | |
long double | REAL10 |
H2INC assumes that a variable is external unless the variable is explicitly declared as static. For example, the C declaration
long big_data;
is converted to this MASM declaration:
EXTERNDEF big_data:SDWORD
See Sections 1.2.6, “Data Types,” and 4.1.1, “Allocating Memory for Integer Variables,” for more information on MASM data types, and Section 8.2.2, “Declaring Symbols Public and External,” for information on EXTERNDEF.
H2INC does not allocate space for arrays since all variables are assumed to be external. For example, the C declaration
int two_d[10][20];
translates to
EXTERNDEF two_d:SWORD
H2INC does not translate static variables, since the scope of these variables extends only to the file where they are declared.