![]() |
| [[ Home | Forums | 3D Engines Database | Wiki | Articles/Tutorials | Game Dev Jobs | IRC Chat Network | Contact Us ]] |
|
|
#1 |
|
DevMaster Staff
Join Date: Sep 2003
Location: Hell
Posts: 1,109
|
I read this article a while back about using recursive preprocessing to enhance the capabilities of an assertion. The article was written by one Andrei Alexandrescu, the author of Modern C++ Design. Here's a direct link to the article that explains the recursive process in details, and the following is the full and IMO minimal implementation of it. This is an excellent tool to have with you. It greatly increases the information you can get out of an assertion.
// Header file. Code:
// Source file Code:
The code is readily compilable on msvc. Im not sure of other compilers because Im not sure if they have the same prototype to make an assertion box appear (Called in the Break() function). An example of using the assert follows: Code:
|
|
|
|
|
|
#2 |
|
Valued Member
Join Date: Aug 2004
Location: Quebec, Canada
Posts: 109
|
interresting...
but the style is very ugly ![]() |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Jan 2003
Location: Switzerland
Posts: 1,333
|
i've played around with such code for a while, by myself, too.. i wouldn't have mixed it with the logging directly, thought.. but for the example purpose it's fine..
___________________________________________
davepermen.net -Loving a Person is having the wish to see this Person happy, no matter what that means to yourself. -No matter what it means to myself.... |
|
|
|
|
|
#4 |
|
New Member
Join Date: Sep 2004
Posts: 20
|
Code:
doesn't compile out of the box. you're missing some \ where you have quotes in quotes. |
|
|
|
|
|
#5 |
|
DevMaster Staff
Join Date: Jan 2003
Posts: 1,201
|
knackered: the code initially contained the backslashes, but it seems a bug in the syntax highlighter removed them. This has been fixed, but hasn't been updated on the site yet.
|
|
|
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|