[Issue 8909] is{File, Dir, SymLink} mix return error code and exception

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 29 14:58:48 PDT 2012


http://d.puremagic.com/issues/show_bug.cgi?id=8909



--- Comment #8 from Jonathan M Davis <jmdavisProg at gmx.com> 2012-10-29 14:58:46 PDT ---
Checking whether the file exists makes it so that you don't have to take the
performance hit when the exception is thrown and allows you to treat the
exception as the exceptional case rather than expected. But since it makes no
sense to return either true or false when the file can't be checked (due to no
longer existing or a lack of permissions or whatever), there's really no choice
but to throw an exception unless you want to go the C route of returning an
error code and doing the actual return through a pointer or ref argument. But
if you want that, just use the C functions. Regardless, you can't assume that
the function will work, because it can fail even if you check for the file's
existence beforehand.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list