Using enforce or assert to check for fullness when appending to fixed length array container

Tobias Pankrath tobias+dlang at pankrath.net
Fri Oct 4 11:41:40 UTC 2019


On Friday, 4 October 2019 at 10:00:08 UTC, Per Nordlöw wrote:
> Is the usage of `enforce` to check for out of bounds (fullness) 
> idiomatic D or should an `assert()` be used instead?

I'd say it should follow -boundscheck: 
https://dlang.org/dmd-linux.html#switch-boundscheck

Does that set an version identifier?


More information about the Digitalmars-d-learn mailing list