Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fully Featured C++ Assert Dialog?

I'm looking for a good, fully featured C++ assert macro for VisualStudio. With features like be able to ignore an assert once or always, to be able to break exactly where the macro gets called (and not inside macro code), and getting a stack trace.

Before I have to hunker down and write one, I figured I'd ask if anyone knows about any available ones out there.

Any suggestions?

Thanks!

like image 603
djcouchycouch Avatar asked Dec 30 '22 22:12

djcouchycouch


2 Answers

See Charles Nicholson's blog for a good discussion of an assert macro. His solution breaks the debugger at the faulting line of code (and not inside the failed assertion handler), and he also solves the problem of not getting warnings about unused variables when assertions are disabled without incurring any runtime costs.

like image 155
Adam Rosenfield Avatar answered Jan 19 '23 08:01

Adam Rosenfield


Here's a link to an article I wrote for DDJ that described, among other things, a library that does much of what you're looking for. Although I don't just use macros, I also implement functions in a DLL.

http://www.ddj.com/architect/184406106

The article from a few years ago and, although I have made many additions, I still use it very liberally in my everyday code.

like image 44
John Dibling Avatar answered Jan 19 '23 08:01

John Dibling