Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 750127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:30:56+00:00 2026-05-14T14:30:56+00:00

The question more or less says it all. Given the following record structure: type

  • 0

The question more or less says it all. Given the following record structure:

type
    TPerson = record
        Name: string;
        Age: Integer;
    end;
    PPerson = ^TPerson;
    TPersonList = TList<TPerson>;

Is the following code valid?

procedure ReadPeople(DataSet: TDataSet; PersonList: TPersonList);
begin
    PersonList.Count := DataSet.RecordCount;
    if DataSet.RecordCount = 0 then
        Exit;

    DataSet.First;
    while not DataSet.Eof do begin
        PersonList[DataSet.RecNo].Name := DataSet.FieldByName('Name').AsString;
        PersonList[DataSet.RecNo].Age := DataSet.FieldByName('Age').AsInteger;
        DataSet.Next;
    end;
end;

Do I have to use GetMem/FreeMem to allocate and free records an instance of TPersonList, or am I free to directly access the TPersonList entries directly? My gut says that the code should be valid, though I’m not sure if there’s any wrinkles related to record initialization or finalization.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T14:30:56+00:00Added an answer on May 14, 2026 at 2:30 pm

    Your code’s fine. When you use Tlist<T> with records, it treats them as value types, to be copied around. There’s no need to allocate pointers for them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is stemmed from another question I had where the solution had me using
I will preface the question by saying that I am somewhat new to the
I'm currently using boost::intrusive_ptr together with my GUI classes. Although this is more or
I'm wondering, what's the origin of asking interviewees to manually parse a string as
There's quite a few questions on Stack Overflow about id vs class but these
I am currently getting myself up to speed with SharePoint 2010 and I am
I came across this code in a large codebase DWORD WINAPI ThreadFunc (LPVOID lpParam)
In my thesis, I'm finding footnotes get placed just below the lowest text on
I've written the rudiments of a class for creating dynamic structures in C++. Dynamic
I am new to android and only have a little experience with HTML and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.