Not true, records can have long strings. They are stored as pointer values in the record structure and occupy 4 bytes each. The string data is allocated as another memory block.
----- Original Message ----- From: "Jeremy Coulter" <[EMAIL PROTECTED]> To: "'Alistair George'" <[EMAIL PROTECTED]>; "'NZ Borland Developers Group- Delphi List'" <[EMAIL PROTECTED]> Sent: Tuesday, June 29, 2004 10:19 AM Subject: RE: [DUG] Pointers (again) > With a record, a String has to be a specific size, i.e string[x] > x=specific string size, i.e. 3, 5, 255 or whatever you need. > > If its uesed in your example :- > > TPNodeData = ^TNodeData; > TNodeData = record > Index, Level, from, adds, subject, body: Integer; > FullPath, UIDL: string[255]; > end; > > HTH > > Jeremy > > -----Original Message----- > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > On Behalf Of Alistair George > Sent: Tuesday, 29 June 2004 09:43 > To: [EMAIL PROTECTED] > Subject: [DUG] Pointers (again) > > > Last night I got out my Delphi books - you know, the decent ones that > you got when you purchased Delphi years ago. Unfortunately, the downside > of them was that the information is disbursed around which makes > following them sometimes a bit tricky. So I am still stymied. > > In the following example, can anyone see if it is in error, as there is > no memory allocation given, and may be the cause of some non-specific > access violation program errors that I was trying to fix. If wrong, > example appreciated. > > type > TPNodeData = ^TNodeData; > TNodeData = record > Index, Level, from, adds, subject, body: Integer; > FullPath, UIDL: string; > end; > > > function GetSpamLevel(from, adds, subject, body: string; Data: > TPNodeData): Integer; > > > > > procedure Tmainform.VTree1InitNode(Sender: TBaseVirtualTree; ParentNode, > Node: PVirtualNode; var InitialStates: TVirtualNodeInitStates); var > Data: TPNodeData; begin //should I insert here: New(Data); > with Sender do > begin > Data := GetNodeData(Node); //Pointer to Node data right? > Data.Index := node.Index; //no memory allocation here. //Here is > data being placed into the pointer 'Data.Level' > Data.Level := GetSpamLevel(SakMsgList1.Items[Data.Index].From, > SakMsgList1.Items[Data.Index].Subject, '', Data); > end; > end; > > > _______________________________________________ > Delphi mailing list > [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi > > _______________________________________________ > Delphi mailing list > [EMAIL PROTECTED] > http://ns3.123.co.nz/mailman/listinfo/delphi > _______________________________________________ Delphi mailing list [EMAIL PROTECTED] http://ns3.123.co.nz/mailman/listinfo/delphi
