proposal: should assert behave like static assert if its possible?

torhu no at spam.invalid
Sat Jan 19 16:03:16 PST 2008


dennis luehring wrote:
> my question for walter is:
> 
> can't assert behave like static assert if the value/condition is 
> available compiletime
> 
> for example:
> 
> int x = byte_bit_to_int( 7, 9 ); // an static assert could do the check
> 
> int x = byte_bit_to_int( 7, random(8) ); // the normal assert is needed

The problem is that sometimes you write things like assert(0), and need 
it to trigger at runtime, not compile time.  So I think there would 
still be a way to do that.



More information about the Digitalmars-d mailing list