R
ReavenK
I was doing a tutorial on inline assemble tricks for C and C++ when I
came upon a little detail that I can't figure out. I was doing a test
program to test out a concept which seems like it should flat out work,
but of course doesn't in a certain circumstance.
I get this error ...
Unhandled exception at 0x004000be in Demo.exe: 0xC0000096: Privileged
instruction.
when I run:
void main()
{
goto Label2;
Label:;
_asm RET
Label2:;
_asm CALL Label
return;
}
....but if I do...
void main()
{
if(0)
_asm JMP Label
goto Label2;
Label:;
_asm RET
Label2:;
_asm CALL Label
return;
}
... Then it works like I would expect. In fact, all I have to do is
somewhere mention the label again using a JMP , even if it's never
called. I looked as the dissassembly Visual Studio 2003 outputed for
the label is completely wrong unless I mention the label
somewhere/anywhere else.
so this also works...
void main()
{
goto Label2;
Label:;
_asm RET
Label2:;
_asm CALL Label
return;
_asm JMP Label;
}
any ideas? Some compiler standard I don't know about or a bug in the
compiler?
came upon a little detail that I can't figure out. I was doing a test
program to test out a concept which seems like it should flat out work,
but of course doesn't in a certain circumstance.
I get this error ...
Unhandled exception at 0x004000be in Demo.exe: 0xC0000096: Privileged
instruction.
when I run:
void main()
{
goto Label2;
Label:;
_asm RET
Label2:;
_asm CALL Label
return;
}
....but if I do...
void main()
{
if(0)
_asm JMP Label
goto Label2;
Label:;
_asm RET
Label2:;
_asm CALL Label
return;
}
... Then it works like I would expect. In fact, all I have to do is
somewhere mention the label again using a JMP , even if it's never
called. I looked as the dissassembly Visual Studio 2003 outputed for
the label is completely wrong unless I mention the label
somewhere/anywhere else.
so this also works...
void main()
{
goto Label2;
Label:;
_asm RET
Label2:;
_asm CALL Label
return;
_asm JMP Label;
}
any ideas? Some compiler standard I don't know about or a bug in the
compiler?