Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Mo Jul 14, 2025 21:50

Foren-Übersicht » English » English Programming Forum
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 4 Beiträge ] 

What should be used:
array of typename 40%  40%  [ 2 ]
tlist 40%  40%  [ 2 ]
whatever 20%  20%  [ 1 ]
Abstimmungen insgesamt : 5
Autor Nachricht
 Betreff des Beitrags: array of VS tlist
BeitragVerfasst: So Okt 17, 2004 18:48 
Offline
DGL Member
Benutzeravatar

Registriert: Di Jul 01, 2003 18:59
Beiträge: 887
Wohnort: (The Netherlands)
Programmiersprache: fpc/delphi/java/c#
what should be prefered: array of typename or TList?

With array of you should take care of memory yourself
With tlist you must use typecasting or make an inherited version of tlist

Wat is the best way to use?

_________________
http://3das.noeska.com - create adventure games without programming


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: So Okt 17, 2004 18:55 
Offline
DGL Member
Benutzeravatar

Registriert: Mo Sep 23, 2002 19:27
Beiträge: 5812
Programmiersprache: C++
There is no "this is the best for all" in this question. I mostly use array of, because it's easy to handle and you don't have to do any typecasts. But especially if you do many operations on the list itself during runtime (sorting, removing items, adding items inbetween) a TList is the better way to go, since it already comes with many needed functions.

_________________
www.SaschaWillems.de | GitHub | Twitter | GPU Datenbanken (Vulkan, GL, GLES)


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Di Okt 19, 2004 14:03 
Offline
DGL Member
Benutzeravatar

Registriert: Do Dez 11, 2003 13:23
Beiträge: 25
Wohnort: South Africa
I generally follow the rule below.

If I want to list TObject/TPersistent instances, I use TObjectList
If I use primitive types (Int, String, whatever) I use dynamic arrays.

The reason for using TObjectList, is that I clears its own memory, and the mem of the object instances inside it when you free it.

Very handy when you have hundereds of objects to keep track of. :) :D

_________________
Im out of my mind but please leave a message...
www.sulaco.co.za


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Di Okt 19, 2004 16:02 
Offline
DGL Member
Benutzeravatar

Registriert: Sa Dez 28, 2002 11:13
Beiträge: 2244
A linked list or hashtable is also usefull sometimes.


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 4 Beiträge ] 
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.009s | 17 Queries | GZIP : On ]