Program logic bugs vs input/environmental errors

Jacob Carlborg via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 1 23:45:21 PDT 2014


On 01/10/14 21:57, Steven Schveighoffer wrote:

> ./progThatExpectsFilename ""
>
> -Steve

It's the developer's responsibility to make sure a value like that never 
reaches the "File" constructor. That is, the developer of the 
"progThatExpectsFilename" application that uses "File". Not the 
developer of "File".

Although, I don't see why you shouldn't be able to pass an empty string 
to "File". You'll just get an exception, "cannot open file ''". This is 
exactly what happens in Bash:

$ echo "asd" > ""
-bash: : No such file or directory

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list