Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Data Structures | Follow Up

Posted on 2004-08-01
1
Medium Priority
?
211 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 34

Accepted Solution

by:
Slick812 earned 1000 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…

916 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