On Wednesday, 7 September 2016 at 22:52:04 UTC, Walter Bright wrote:
On 9/7/2016 2:08 PM, deadalnix wrote:
It is clear at this point that structures with obligatory initialization are
necessary. For C++ but not only.

If not interfacing to C++, why?


I stated why.

Is:

    if (resource != null)
        resource.destroy();

v.s.:

    resource.destroy();


In some cases yes. Consider reference counting for instance.

so onerous? It's one TST/JNE pair for a value loaded into a register anyway. And with a default constructor, there's all that code added to deal with the constructor failing and throwing.


One needs to construct anyway.

Reply via email to