Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Missing error messages

Started by jj2007, February 24, 2024, 07:55:52 PM

Previous topic - Next topic


Local NewString
  NewString db args, 0
  EXITM <offset NewString>
WinMain proc ....
  invoke CreateWindowEx, 0, wc.lpszClassName, Chr$("Hello World"), ...
WinMain endp

Looks harmless, right?
Error A2142: Unmatched block nesting: WinMain

I wasted a lot of time chasing this bug; in the end, it turned out that one word was missing before WinMain proc...:  .code

So when Chr$() is being used, there is a switch from .data to .code :rolleyes:

IMHO a PROC in the .DATA section should trigger a "wrong section" error.

Original post


JWAsm and UAsm have problems with errors, mostly with error location. Nidud solved that, but he change so much things that made his assembler Masm incompatible.
Equations in Assembly: SmplMath


Quote from: jj2007 on February 24, 2024, 07:55:52 PMIMHO a PROC in the .DATA section should trigger a "wrong section" error.

This would introduce a severe incompatibility. The following code - no problems for masm/jwasm/uasm - would be rejected:
.MODEL flat
externdef final_dest:near

assume cs:_DATA

test1 proc
mov eax,1
mov ebx,2
test1 endp

mov esi, offset test1
mov ecx, end_of_test1 - test1
mov edi, offset final_dest
rep movsb


An assembler must be able to handle code as data.
Dummheit, gepaart mit Dreistigkeit - eine furchtbare Macht.


Quote from: _japheth on February 27, 2024, 02:23:32 AMa severe incompatibility

Ok, make it a warning then; anything that gives a hint what "unmatched block nesting" could really mean will be considered helpful.


Silly suggestion.. don't forget .CODE ? :)


Yes, a "warning: you are executing code in the data section - did you forget .CODE?" would be perfect :thumbsup: