|
Boost : |
From: Dan W. (danw_at_[hidden])
Date: 2004-01-05 09:07:32
Allright, just for the record, this is where it stands at right now:
---------------------------------------------------------
//file: ensure.hpp
#ifndef ENSURE_HPP
#define ENSURE_HPP
#ifdef _DEBUG
# define ENSURE(x) do{if(!((x)))asm int 3;}while(0)
#else
# define ENSURE(x) (void)(0)
#endif
#endif
---------------------------------------------------------
//test ensure...
#include "ensure.hpp"
#include <cassert> //last-time included, ever
int main()
{
int i = 2;
ENSURE( i == 2 );
//assert( i != 2 ); //un-comment to feel the pain
ENSURE( i != 2 );
return 0;
}
---------------------------------------------------------
I dare anyone to actually try it, and *then* tell me that it's no better
than assert()...
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk