[Issue 17102] std.write.file generates a segmentation fault when the file name is a string with a default value

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Jan 20 13:27:30 PST 2017


https://issues.dlang.org/show_bug.cgi?id=17102

--- Comment #7 from Vladimir Panteleev <thecybershadow at gmail.com> ---
(In reply to Jack Stouffer from comment #6)
> (In reply to Vladimir Panteleev from comment #5)
> > (In reply to Jack Stouffer from comment #4)
> > > Impossible with macOS.
> > 
> > How so?
> 
> https://issues.dlang.org/show_bug.cgi?id=14927 and
> https://issues.dlang.org/show_bug.cgi?id=8172

Those are implementation issues orthogonal to this one.

(In reply to Jack Stouffer from comment #4)
> We can at least add an assert with an error message.

- Adding an assert won't work, because the Phobos static library is compiled
with -release.
- Adding an explicit if (...) throw new Error(...) will not throw an exception
that would have been caught in #2.
- I still think it's not Phobos' job to validate parameters passed from the
user to the C runtime. It is illogical. Consider:
  - Explicit checks for parameters that will get dereferenced anyway will be
redundant and will add overhead in all cases except when the program is buggy. 
  - D functions in the runtime and standard library which accept reference
types do not perform explicit checks whether a parameter that should never be
null is non-null - dereferencing implicitly does that.
  - I don't see a meaningful distinction in whether null checks should be
present depending on whether the dereference occurs in D or C code.

--


More information about the Digitalmars-d-bugs mailing list