Skip to main content
gamedev.net
🔒 Locked

Breaking

Started by ATronic 3 replies 300+ views
Original Post
ATronic
ATronic
Hey, I''ve made a little assert macro/function that works pretty well. It works like this. Assert(expression); If expression==false, it pops up a messagebox saying "Assert failed! File: filename, Line: linenumber". All is good there. But it asks if you want to break or continue. I tried using advice from a book like so. #define Break() { _asm { int 3 } } They say it will break. Mind you all of this stuff is enabled only in a debug compile. I am using codewarrior, and was wondering how to break in it. The code above is said to work, but it may only be for msvcpp. It crashes in mine. Anyone have any ideas? Alex Broadwin A-Tronic Software & Design ----- "if you fail in life, you were destined to fail. If you suceed in life, call me." "The answer is out there." "Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"
ATronic
ATronic
Shockingly, this is not the answer I seek. MSVCPP is the DEVIL! Heh, really. Codewarrior has by far superior optimizations, and I like the interface more.

Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"
Dean Harding
Dean Harding
It''ll crash with a debug break exception. That''s what you want it to do. It won''t just automatically go to the line where the int 3 happened.

"int 3" isn''t an MSVC++ thing, it''s the standard "debug break" interrupt.

Another way to get the same effect is to use the DebugBreak() API function, which compiles down to the same thing, but in a more compiler-independant way (i.e. you don''t need to use inline assembly).


codeka.com - Just click it.
ATronic
ATronic
Thanks! That makes sense!

Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.