PRB: H2INC Does Not Handle #undef
Article ID: 120068
Article Last Modified on 2/11/2004
APPLIES TO
- Microsoft Macro Assembler 6.1 Standard Edition
- Microsoft Macro Assembler 6.11 Standard Edition
This article was previously published under Q120068
SYMPTOMS
The H2INC utility does not appear to handle #undef correctly. For example,
the following code fragment causes "error A2005: symbol redefinition:
test2" to appear:
#define test2 2
#if test2 == 2
#undef test2
#define test2 3
#endif
CAUSE
This behavior is by design.
The following .INC file is generated for the fragment listed in the
"SYMPTOMS" section:
option expr32
option casemap:none
; Begin of file xxx.h
test2 EQU 2t
test2 EQU 3t
; End of file xxx.h
NOTE: In MASM, constants defined with EQU cannot be redefined.
RESOLUTION
A #define can define "text equates" as well as "numeric equates." In the
case of numeric constants, use an editor to change the "EQU" to a "=".
Additional query words: 6.10 6.11
Keywords: KB120068