“Out” parameters and destructors

Manfred Nowak svv1999 at hotmail.com
Sat Mar 15 20:21:41 UTC 2025


On Friday, 14 March 2025 at 07:30:14 UTC, Ogion wrote:
[...]
>     ~this() {
>         if (initialized) {
>             writeln("~S()");
If one moves the line containing 'writeln´ one line up before the 
'if´-condition, then one might be notified of all calls---and one 
might be able to recognize more than one call of the destructor.

[...]
>     s = S(42);

The docs at 15.20.2 look very similar to:
>Struct assignment 't=s´ is defined to be semantically equivalent 
>to:
>>   t.opAssign(s);

If there is no 'opAssign´ in 'S´ the compiler might insert a 
default. If a default is inserted, does it suffice?






More information about the Digitalmars-d mailing list