|
Boost : |
From: Arturo R Montesinos (aramirez_at_[hidden])
Date: 2000-11-05 14:07:39
> Accepted, however how do people want the error message to read, retain
> "COMPILE_TIME_ASSERTION_FAILURE" or change to "STATIC_ASSERTION_FAILURE"
> for consistency?
I would argue that "compile-time assert" is MUCH less confusing.
When I do something like this at file scope:
---8<-------------------------------------------------------------------
#define AUX1_PASTE(X,Y) AUX2_PASTE(X,Y)
#define AUX2_PASTE(X,Y) X##Y
#define PASTE(X,Y) AUX1_PASTE(X,Y)
#define assertonexit(x) static struct PASTE(STATICCHECK,__LINE__) \
{~PASTE(STATICCHECK,__LINE__)(){assert(x);}}PASTE(StaticCheck,__LINE__);
//...
bool initd = false;
assertonexit( initd==false ); // assert that initd is false on shutdown
---8<-------------------------------------------------------------------
Can I not call this a "static assert" with more property than boost's
proposed usage?
One of the more original meanings of "static" refers only to the lifetime
of an object, and I would venture that anyone would be hard pressed to
find anything "static" about what is essentially a compile-time assertion.
There are already too many meanings for "static" going around (plus we
all know how badly C++ overloaded THAT keyword), so why add even more?
------------------------------------------------------------
Arturo R Montesinos
arturorm_at_[hidden], aramirez_at_[hidden]
Madrid, Spain
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk