assume, assert, enforce, @safe

Sean Kelly via Digitalmars-d digitalmars-d at puremagic.com
Thu Jul 31 14:29:57 PDT 2014


On Thursday, 31 July 2014 at 21:11:17 UTC, Walter Bright wrote:
> On 7/31/2014 1:52 PM, Sean Kelly wrote:
>> Could you expand on what you consider input?
>
> All state processed by the program that comes from outside the 
> program. That would include:
>
> 1. user input
> 2. the file system
> 3. uninitialized memory
> 4. interprocess shared memory
> 5. anything received from system APIs, device drivers, and DLLs 
> that are not part of the program
> 6. resource availability and exhaustion

So effectively, any factor occurring at runtime.  If I create a
library, it is acceptable to validate function parameters using
assert() because the user of that library knows what the library
expects and should write their code accordingly.  That's fair.


More information about the Digitalmars-d mailing list