Use of Parentheses for Operator Precedence Necessary

ID Number: Q39443

5.00 | 5.10

MS-DOS | OS/2

Summary:

You may be able to correct "Illegal size for operand" errors by

careful use of parentheses.

Microsoft has confirmed this to be a problem in Version 5.10. We are

researching this problem and will post new information as it becomes

available.

More Information:

The following code demonstrates warnings, errors, and their solution:

dosseg

.model small,c

.data

.code

foo PROC buffer:FAR PTR BYTE

mov bx, WORD PTR buffer[0]

mov ds, WORD PTR buffer[2]

; MASM gives an operand-size error. This is a precedence problem that

; you can correct with parentheses:

mov bx, WORD PTR (buffer[0])

mov ds, WORD PTR (buffer[2])

foo ENDP

end

......................................................................

masm test,,,;

Microsoft Ò Macro Assembler Version 5.10

Copyright Ó Microsoft Corp 1981, 1988. All rights reserved.

test.ASM(9): warning A4057: Illegal size for operand

test.ASM(10): error A2057: Illegal size for operand

23666 Bytes symbol space free

1 Warning Errors

1 Severe Errors

.......................................................................