Program logic bugs vs input/environmental errors
Jacob Carlborg via Digitalmars-d
digitalmars-d at puremagic.com
Mon Sep 29 07:48:12 PDT 2014
On 29/09/14 13:51, Steven Schveighoffer wrote:
> That makes no sense. The opening of the file is subject to issues with
> the filesystem, which means they may be environmental or user errors,
> not programming errors. But that doesn't mean the opening of the file
> failed because the file doesn't exist, it could be an error in how you
> construct the file name.
>
> What about:
>
> File f;
> f.open(null);
>
> Is that an environmental error or User error?
That depends on what "open" expect from its argument. In this particular
case, in D, "null" is the same as the empty string. I don't see why that
technically shouldn't be allowed.
Of course, you can specify that "open" expects a string argument with
the length that is greater then 0, in that case it's a bug by the
programmer that uses the "open" function.
--
/Jacob Carlborg
More information about the Digitalmars-d
mailing list