BUG: Continuation Char with Initializing Structures

Last reviewed: October 21, 1994
Article ID: Q75601
The information in this article applies to:
  • Microsoft Macro Assembler for MS-DOS, versions 5.1, 5.1a, 6.0, 6.0a, 6.0b, 6.1, 6.1a, and 6.11
  • Microsoft Macro Assembler for OS/2, versions 5.1, 5.1a, 6.0, 6.0a, and 6.0b

SYMPTOMS

When initializing a structure in the Microsoft Macro Assembler (MASM), if the initializers are written on separate lines, one or more of the following errors may occur:

   MASM 6.x    A2045: missing angle bracket or brace in literal
   MASM 6.x    A2009: syntax error in expression
   MASM 5.x    A2105: expected: instruction, directive or label

RESOLUTION

To work around this problem, either use the backslash (\) line continuation character following a comma, or with MASM 6.0 and later use curly braces in place of the angle brackets. Curly braces are a legal substitute syntax for angle brackets. The sample code below illustrates the problem syntax and the workaround.

STATUS

Microsoft has confirmed this to be a problem in MASM versions 5.1, 5.1a, 6.0, 6.0a, 6.0b, 6.1, 6.1a, and 6.11. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

Page 127 of the "Microsoft Macro Assembler Programmer's Guide" from MASM 6.0 states:

   The list of initializers can be broken only after a comma unless
   you use a line continuation character (\) at the end of the line.

The following sasmple code can be used to demonstrate the problem.

Sample Code

; Assemble options needed: /c

.MODEL small

name1 STRUCT

   sub1 DB 'item'
   sub2 DW ?
name1 ENDS

.DATA

;item3 name1 {'am',     ; assembles correctly
;             14}

;item4 name1 <'pm',\    ; assembles correctly with the
;             18>       ; (\)continuation character

item3 name1 <'am',      ; this generates an error
             14>        ; MASM 6.0 A2045: missing angle bracket or
                        ; brace in literal
                        ; MASM 5.1 A2105: expected: instruction,
                        ; directive or label

item4 name1 <'pm'\      ; this generates an error
             18>        ; MASM 6.0 A2009: syntax error in expression
                        ; MASM 5.1 A2105: expected: instruction,
                        ; directive or label
.CODE
   mov ax, @data        ; initialize the ds register
   mov ds, ax
   mov ax, item3.sub2   ; for verifying the values
   mov ax, item4.sub2   ; of the initialization, in CodeView
   mov ax, 4C00h
   int 21h
END


Additional reference words: 5.10 5.10a 6.00 6.00a 6.00b 6.10 6.10a
buglist6.00a buglist6.00b buglist6.10 buglist6.10a buglist6.11
KBCategory: kbtool kbbuglist
KBSubCategory: MLIss


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: October 21, 1994
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.