MSM9108006: Continuation Char with Initializing Structures

ID Number: Q75601

5.10 5.10a 6.00 6.00a | 5.10 5.10a 6.00 6.00a

MS-DOS | OS/2

buglist5.10

Summary:

PROBLEM ID: MSM9108006

SYMPTOMS

When initializing a structure in the Microsoft Macro Assembler

(MASM) versions 5.1, 5.1a, 6.0, or 6.0a, if the initializers are

written on separate lines, one or more of the following errors may

occur:

MASM 6.0 A2045: missing angle bracket or brace in literal

MASM 6.0 A2009: syntax error in expression

MASM 5.1 A2105: expected: instruction, directive or label

RESOLUTION

To work around this problem, either use the backslash (\) line

continuation character following a comma, or 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, and 6.0a. We are researching this problem and will post

new information here as it becomes available.

More Information:

Page 127 of the "Microsoft Macro Assembler Programmer's Guide" 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.

Sample Code

-----------

; Assemble options needed: ML -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

nop

nop

end

Additional reference words: 5.10 5.10a 6.00 6.00a