-1

I am trying some assembly code to learn how it works but in my first example i faced with the buffer overrun exception. I am using VS2013 express edition and i am using c++ code to make the assembly code work by using extern "C" functionality. I tried to change some VS options but it did not work. What could be reason to give a buffer overrun exception while it is that much simple statement. Normally i build and executed without the mov statement.

Edit : Just add a ret statement for the macro and the problem solved.

This is assmbly part:

.586
.model flat,c
.data
.code

doit proc

mov eax, 8  
doit endp
end

and here it is c++ part:

extern "C" void doit();


void main()
{  

doit();

}
4

1 回答 1

-1

原因是汇编程序没有ret语句。所以程序的行为是未定义的。:)

于 2014-09-30T14:54:54.830 回答