“Out” parameters and destructors

Basile B. b2.temp at gmx.com
Tue Mar 18 17:19:43 UTC 2025


On Friday, 14 March 2025 at 07:30:14 UTC, Ogion wrote:
> Functions with `out` parameters simply initialize the parameter 
> with `.init`, instead of properly destroying it.
> [...]

According to me that's clearly a bug. The destructor should be 
called.
Otherwise you end up, for example, with user-types relying on ref 
counting that dont work anymore.

That being said, `out` parameters just exist because of languages 
that dont guarante that what's passed in is well defined. That's 
another debate.




More information about the Digitalmars-d mailing list