@MrSwiss,
Your overload "Destructor xyz2 ()" is useless because the implicit destructor of xyz2 already does an equivalent thing (the member string already being a pre-defined object itself).
Losing memory because of String usage
Re: Losing memory because of String usage
Last edited by fxm on Jun 01, 2018 15:06, edited 2 times in total.
Re: Losing memory because of String usage
Mr Swiss
I understand of course.
But I believe wallyg has thousands of code lines (using any ptr --Correct wallyg??)
And 57 types.
So, I take my lead from there.
Hopefully he/she can implement your other solutions easily.
I understand of course.
But I believe wallyg has thousands of code lines (using any ptr --Correct wallyg??)
And 57 types.
So, I take my lead from there.
Hopefully he/she can implement your other solutions easily.
Re: Losing memory because of String usage
@fxm, all the implicit 'stuff' unfortunately hasn't the decency, to tell us:
"what it does" (or not), in any possible constellation ...
@dodicat, your reasoning has substance (but, it may also be, a simple
oversight, by OP).
"what it does" (or not), in any possible constellation ...
@dodicat, your reasoning has substance (but, it may also be, a simple
oversight, by OP).
Re: Losing memory because of String usage
Everything that is predefined becomes implicit for the user.
But it would not occur to you to destroy the string data just before the variable comes out of its scope, like that:
So, why do it for a member string?
But it would not occur to you to destroy the string data just before the variable comes out of its scope, like that:
Code: Select all
Scope
Dim As String s
s = String(1000, 0)
'.....
s = "" '' useless
End Scope
Re: Losing memory because of String usage
For examples sake ... to show, what implicit is expected to do.fxm wrote:So, why do it for a member string?
Re: Losing memory because of String usage
If user defines its own constructor (or destructor), all is done in the implicit default construction (or destruction) is added before (or after) its code body.
But the things done in the default copy-construction (or default copy-assignation) are never added to the user copy-constructor (or copy-assignment operator).
But the things done in the default copy-construction (or default copy-assignation) are never added to the user copy-constructor (or copy-assignment operator).
Re: Losing memory because of String usage
wallyg wrote:Thank you all for trying to help. ...I asked a simple question...I expected to get a 2 character response ie. NO. or a 1 line example on how to do this...,
This is an open forum and the answers here are not just for you but for the next guy as well.
Perhaps the next guy will want to learn from the answers.
but my programs work and get the job done
Well they mostly work right? ;)