Recent

Author Topic: Create and free TStringList Question(Solved)  (Read 2306 times)

Thaddy

  • Hero Member
  • *****
  • Posts: 14161
  • Probably until I exterminate Putin.
Re: Create and free TStringList Question
« Reply #15 on: March 25, 2023, 04:52:37 pm »
I did not insult Bart.
You did insult someone in this thread, and given the reply number of that insult, it's most likely me.

I merely put that classes should *always* be free'd in reverse order of creation and Bart knows that.
And you are wrong, as PascalDragon pointed out.

Unfortunatley you seem to be unable to admit you are wrong.
At least I've never seen you do that.
(Of course there's a chance (probably p=1/+inf) that you actually are the one person that is always right.)

Bart
As I read it and understood Sarah's answer only applies to situations where there are no dependencies between the list and other controls or code in general.
So I am not wrong at all.
If you felt offended (hard to believe) my apologies.

And, sorry, wrong order is a source of bugs and should not be encouraged.
« Last Edit: March 25, 2023, 05:01:32 pm by Thaddy »
Specialize a type, not a var.

JLWest

  • Hero Member
  • *****
  • Posts: 1293
Re: Create and free TStringList Question
« Reply #16 on: March 25, 2023, 05:05:25 pm »
I think I'll free them in reverse order. Either way there is no cost.

Thanks all.
FPC 3.2.0, Lazarus IDE v2.0.4
 Windows 10 Pro 32-GB
 Intel i7 770K CPU 4.2GHz 32702MB Ram
GeForce GTX 1080 Graphics - 8 Gig
4.1 TB

Bart

  • Hero Member
  • *****
  • Posts: 5265
    • Bart en Mariska's Webstek
Re: Create and free TStringList Question
« Reply #17 on: March 25, 2023, 05:35:50 pm »
So I am not wrong at all.

I merely put that classes should *always* be free'd in reverse order of creation and Bart knows that.

And that statement just is wrong.
As PascalDragon and others have pointed out to you.

How hard is it for you to simply admit this?

If you felt offended (hard to believe) my apologies.

Why is it hard for you to believe you offend someone if you question their degree?
I didn't buy my degree at the Hema.
I studied (in total 12 years) to earn the degrees I have, and I'm proud of them.
And none of those degrees have any bearing on the topic of programming, so questioning them in the context of this discussion is unneeded and therefore makes it even more insulting to me.

Anyway: apoligies accepted.

Bart

Thaddy

  • Hero Member
  • *****
  • Posts: 14161
  • Probably until I exterminate Putin.
Re: Create and free TStringList Question(Solved)
« Reply #18 on: March 25, 2023, 05:39:56 pm »
The statement is correct. Always release resources (whatever they are) in reverse order of creation.
This is a simple rule.

Or are you - like me - suffering from Frenchman syndrom? Siily young bastards...
( I have to offend some people by nature: this time the French )
« Last Edit: March 25, 2023, 05:46:26 pm by Thaddy »
Specialize a type, not a var.

Bart

  • Hero Member
  • *****
  • Posts: 5265
    • Bart en Mariska's Webstek
Re: Create and free TStringList Question(Solved)
« Reply #19 on: March 25, 2023, 06:26:40 pm »
The statement is correct. Always release resources (whatever they are) in reverse order of creation.
This is a simple rule.
It is not mandatory.
It may be advisable, but in simple cases like the above, it absolutely does not matter at all.
Why cannot you believe even one of the core fpc developers about that?

The phrasing of your statement (the one I quoted) makes it wrong.

Bart

Thaddy

  • Hero Member
  • *****
  • Posts: 14161
  • Probably until I exterminate Putin.
Re: Create and free TStringList Question(Solved)
« Reply #20 on: March 25, 2023, 06:31:26 pm »
Sigh, Bart. We are getting too old for such skirmishes. Why not simply say I am right?
Specialize a type, not a var.

Bart

  • Hero Member
  • *****
  • Posts: 5265
    • Bart en Mariska's Webstek
Re: Create and free TStringList Question(Solved)
« Reply #21 on: March 25, 2023, 10:48:25 pm »
Sigh, Bart. We are getting too old for such skirmishes. Why not simply say I am right?

Because you simply are not.

I wonder if I live to see the day that you ever admit you are wrong about anything...

Bart

 

TinyPortal © 2005-2018