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

  • Home
  • SEARCH
  • 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 9153841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:20:17+00:00 2026-06-17T12:20:17+00:00

I have two records with the same fields and one of them has a

  • 0

I have two records with the same fields and one of them has a set of procedures. Why the Size of both records is the same?

{$APPTYPE CONSOLE}

{$R *.res}

uses
  System.SysUtils;

type
  TData = record
    Age : Byte;
    Id  : Integer;
  end;

  TData2 = record
    Age : Byte;
    Id  : Integer;
    procedure foo1;
    procedure foo2;
    procedure foo3;
  end;

procedure TData2.foo1;
begin

end;

procedure TData2.foo2;
begin

end;

procedure TData2.foo3;
begin

end;

begin
  try
    Writeln('SizeOf(TData) = '+ IntToStr(SizeOf(TData)));
    Writeln('SizeOf(TData2) = '+ IntToStr(SizeOf(TData2)));
    Readln;
  except
    on E: Exception do
      Writeln(E.ClassName, ': ', E.Message);
  end;

end.
  • 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-06-17T12:20:18+00:00Added an answer on June 17, 2026 at 12:20 pm

    That’s because the record itself only carries with the data that composes the record and no procedures or functions. The procedures and functions are a kind of syntactic sugar to avoid passing the record itself as a parameter: the self variable that is automagically added by the compiler for you.

    Each method you declare in a record have another parameter for the record itself, for example:

      TData2 = record
        Age : Byte;
        Id  : Integer;
        procedure Foo1;
        procedure Foo2(SomeParam: Integer);
      end;
    

    is changed to something equivalent to:

      PData2 = ^TData2;
    
      TData2 = record
        Age : Byte;
        Id  : Integer;
      end;
    
      procedure TData2_Foo1(Self: PData2);
      procedure TData2_Foo2(Self: PData2; SomeParam: Integer);
    

    end each call you make is also changed, for example:

    var
      Data: TData2;
    begin
      Data.Foo1;
      Data.Foo2(1);
    end;
    

    is changed for something equivalent to:

    var
      Data: TData2;
    begin
      TData2_Foo1(@Data);
      TData2_Foo1(@Data, 1);
    end;
    

    I have no Delphi at hand to check if the parameter is added at the beginning or at the end of your parameter list, but I hope you get the idea.

    Of course there’s no real syntax for this, since it is done on the fly by the compiler and thus, for example, the procedure names are not changed. I did that in a try to make my answer easy to understand.

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

Sidebar

Related Questions

I have two tables with exactly the same fields. Table A contains 7160 records
We have two A records pointing to same public IP address as: www.example.com IN
I have two large tables in MySQL, one containing about 6,00,000 records and another
I want to delete multiple records at once. I have two tables, one that
I have two Numpy record arrays that have exactly the same fields. What is
I have two tables named as table1 ,table2.Both the tables are having same no
I have two tables called TableA and TableB. TableA has the following fields: TableA_ID
I have two database tables, one in MYSQL and one in MSSQL. Both have
lets say, i have two tables, one for object records and one for activity
I am working on a form which has two fields. One is code 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.