Message board for the users of flat assembler.
> Macroinstructions > local structures NOT local with new proc/local macros
The consequence of what might be considered bad programming technique, caused a problem for me today. To demonstrate what I think shouldn't happen, I put together this demo. If a local structure has the same name as a previous local structure, the second local structure is given the same structure definition as the first local structure.:
test_proc proc hFti DWORD, AllOrSome DWORD local lvi LVITEM local .buffer BYTE 20 dup ? local .row DWORD lea eax, lvi.mask lea eax, lvi.iItem lea eax, lvi.iSubItem lea eax, lvi.state lea eax, lvi.stateMask lea eax, lvi.pszText lea eax, lvi.cchTextMax lea eax, lvi.iImage lea eax, lvi.lParam lea eax, lvi.iIndent lea eax, .buffer lea eax, .row ret test_proc endp test_proc2 proc hFti DWORD, AllOrSome DWORD local lvi LVFINDINFO local .buffer BYTE 20 dup ? local .row DWORD lea eax, lvi.flags lea eax, lvi.psz lea eax, lvi.lParam lea eax, lvi.vkDirection lea eax, lvi.mask lea eax, lvi.iItem lea eax, lvi.iSubItem lea eax, lvi.state lea eax, lvi.stateMask lea eax, lvi.pszText lea eax, lvi.cchTextMax lea eax, lvi.iImage lea eax, lvi.lParam lea eax, lvi.iIndent lea eax, .buffer lea eax, .row ret test_proc2 endp
The first four command lines of test_proc2 won't assemble because lvi here is considered LVITEM--as defined in test_proc--instead of LVFINDINFO. The remaining lines of test_proc2 will assemble if the first four are commented out. I tried everything I could think of: put a . before each lvi; put a . and a space before each lvi (that didn't assemble); but neither allowed lvi to be differentiated.
Thanks for any help. For now I'll just use unique names.
Thanks again for an impressive product!
Some Assembly Required
It's a good day to code!
U.S.Constitution; Bill of Rights; Amendment 1:
... the right of the people peaceably to assemble, ...
The code is dark, and full of errors!
|19 Jun 2005, 09:04||
It's my stupid mistake in the variable localization macro, I'm updating it in the official package. For the quick fix, find this line in the "deflocal@proc" macro:
match vars, all@vars \