[phobos] Usage of asserts/contracts and memory safety
Vladimir Panteleev
thecybershadow.lists at gmail.com
Wed Aug 24 21:23:06 PDT 2011
On Thu, 25 Aug 2011 06:49:09 +0300, Jonathan M Davis <jmdavisProg at gmx.com>
wrote:
> So, I'd say that you should pick whether to use assert or enforce on
> function
> arguments based on how bad it is if the test is skipped (as happens with
> assertions and -release), how performant the code must be (truly
> performance-
> critical code may not be able to afford the cost of testing in -release
> mode as
> would happen with enforce), and how likely it is that bad arguments are a
> result of a bug in the program rather than the state of a particular run
> of
> the program.
Thanks for the detailed explanation. Based on the above, it's quite clear
that my case should use "enforce".
https://github.com/CyberShadow/phobos/commit/8be7c18cf3b5553e0302d8766b0445d4d97e6665
--
Best regards,
Vladimir mailto:vladimir at thecybershadow.net
More information about the phobos
mailing list