Boost logo

Boost :

From: Beman Dawes (beman_at_[hidden])
Date: 2000-11-09 13:18:40

John Maddock wrote:

>>Perhaps I should just work on a core proposal for a new language
>>feature. All of the macro uses we are talking about are needed to get
>>__FILE__ and __LINE__. How about two new special symbols:
>>namespace boost {
>> static_assert( bool exp, const char * file=__FILE_AT_USE,
>> int line=__LINE_AT_USE );
>>The compiler is required to replace these with the appropriate value at
>>point of a call to static_assert(), rather than at point of declaration.
>If this were going forward as part of the standard I would say yes call
>"static_assert" and place it <cassert>, either as a regular macro, or as
>core language extention (depending how the vendor sees it).
>However, there is a problem with your approach wrt boost: how does the
>static_assert function you've defined above, convert the bool parameter
>a static assertion (as an integral constant expression)?

I don't know without language support. It keeps coming back to that; there
needs to be better language support for diagnostic tools.

__FILE_AT_USE and __LINE_AT_USE would allow some better user written tools
like various improved runtime asserts, so they wouldn't be be totally
useless. I'm just trying to provoke thought, not actually present a
finished solution.


Boost list run by bdawes at, gregod at, cpdaniel at, john at