Solved

Data Structures | Follow Up

Posted on 2004-08-01
1
203 Views
Last Modified: 2010-04-05
Q is follow up of http:Q_21077801.html

Detailing a bit of Dynamic Arrays and how to get the size of them plus some tips and tricks...
0
Comment
Question by:Cerf
1 Comment
 
LVL 33

Accepted Solution

by:
Slick812 earned 250 total points
ID: 11690698
I will guess that you need the sizeOf for some kind of memory copy of array data?
if you have used fixed arrays you can get the array Data by the array variable's pointer address

var
aryFixed: TPMem51;

begin
CopyMemoy(@aryFixed, pPointer, SizeOf(aryFixed));
 - - - - - - - - -

but this will NOT work with dynamic arrays because the variable is jus a pointer to a delphi reference that handles the dynamic array, to use a pointer location for a dynamic arrat, I use the address of the first element

var
 _tData: Array of Word;

begin
// setlength and whatever
 pData := @_tData[0]; // first element of array for memory address od the array data


however, a SizeOf( ) for ANY TObject, or dynamic array (a String type is a dynamic array) it will ALWAYS return 4 , because these Objects and dynamic arrays are Pointers, because objects and dyn arrays are ReAllocated memory blocks,
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video discusses moving either the default database or any database to a new volume.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now