Can someone please explain me, why the following code causes an "error A2081: missing operand after unary operator"?
If you know a workaround, please help!



ListViewNotify proc hwndList :DWORD, lPar :DWORD

push esi
push edi

mov esi, lPar
assume esi:ptr NMHDR

.if [esi].code == LVN_GETDISPINFO
mov edi, lPar
assume edi:ptr LV_DISPINFO

[b] .if ([edi].item.mask & LVIF_TEXT) ; <- error A2081 in this line[/b]

mov [edi].item.pszText, offset szAppName

.endif

.endif

pop esi
pop edi

ListViewNotify endp
Posted on 2001-10-01 05:32:51 by bazik
shit....

the correct structure member ist "imask" (although it's "mask" in MSDN). If I change .item.mask to .item.imask, it works :)
Posted on 2001-10-01 06:03:40 by bazik
.if (.item.mask & LVIF_TEXT)


that's not difficult: if always expects a value like:

if this=that then ......

but you only have:

if this ..........

but where's the "that"? this is the operand that is missing. btw: don't you have to use && instead of just &?

NOP-erator
Posted on 2001-10-01 06:06:25 by NOP-erator
just saw your post. why does it work? am i wrong???

NOP-erator
Posted on 2001-10-01 06:07:32 by NOP-erator

just saw your post. why does it work? am i wrong???


Jup :)



Comparison run-time operators
Operator Meaning
== Equal
!= Not equal
> Greater than
>= Greater than or equal to
< Less than
<= Less than or equal to
& Bit test (format: expression & bitnumber)
! Logical NOT
&& Logical AND

|| Logical OR


>but where's the "that"?

It's not BASIC, it's ASM :grin:
Posted on 2001-10-01 06:34:00 by bazik
A zero value is considered false, hence ".if (1)" is valid syntax, and will evaluate to true.

What the code will compile to is:


test [edi].item.imask, LVIF_TEXT ;Perform bitwise AND but don't store result
jz @F ;If its zero we consider it false
;Stuff inside the IF here!
@F ;End of the IF


C is the same

Mirno
Posted on 2001-10-01 06:46:31 by Mirno
ok, got the point.

NOP-erator
Posted on 2001-10-01 07:17:50 by NOP-erator