Why is D unpopular?

Guillaume Piolat first.last at gmail.com
Mon May 23 13:45:24 UTC 2022


On Monday, 23 May 2022 at 08:46:13 UTC, Dukc wrote:
>
> ```d
> // debug assertion, use when you suspect performance impact
> debug assert(condition);
>
> // regular assertion. Should be on for most applications even 
> in release builds, but can be omitted if you're willing to 
> accept you don't have memory safety if an assert fails. Should 
> be the most common assert.
> assert(condition);
>
> // Semi-strong assertion. Should be on for all applications 
> that care about memory-safety at all. Use for custom bounds 
> checking in `@trusted` or `@system` code.
> version(D_NoBoundsChecks){} else if(!condition) assert(0)
>
> // Strong assertion. Always on.
> if(!condition) assert(0);
> ```


Good tips.
Using if(!condition) assert(0); for release assertion seems 
reliable.
If D ever changes this in favor of a more explicit syntax, it 
would need a deprecation period.


More information about the Digitalmars-d mailing list