?
Solved

adjust the size of a dynamic array

Posted on 2008-10-27
6
Medium Priority
?
240 Views
Last Modified: 2013-11-23
why can't I do:
1)


TPointList = array of TPoint

function(...)  :  TPointList
begin
     setlength (myPoint, n)

    result :=  myPoint;
end;


2)  function  newPoints (var  aPointList)
    begin
      setlength aPointList, n)
     ......
   end;

both functions seem to be mega buggy ....
0
Comment
Question by:BdLm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 19

Expert Comment

by:MerijnB
ID: 22815512
what kind of bugs do you encounter?
0
 
LVL 17

Assisted Solution

by:TheRealLoki
TheRealLoki earned 500 total points
ID: 22816548
don't forget, that unless you state otherwise, your aray will be zero based
ie. the first element will be [0], the 2nd will be [1]
so when you do
SetLength(myarray, 2)
you can use elements 0, and 1, NOT 2

also your sample 2 has a typo (mising "("  )

2)  function  newPoints (var  aPointList)
    begin
      setlength(aPointList, n)
     ......
   end;
0
 
LVL 8

Author Comment

by:BdLm
ID: 22817340
I made a sampler app, everthing seem to be fine, now in the
real world app i just made an array with 10  element, the first 4  points showed the corecct data, the others are (0,0) points
 
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 19

Assisted Solution

by:MerijnB
MerijnB earned 500 total points
ID: 22817349
sounds like a bug where you overwrite memory or something.
0
 
LVL 8

Author Comment

by:BdLm
ID: 22819499
found the bug,
wrong loop construction while copying the data to the array .-(
0
 
LVL 8

Accepted Solution

by:
BdLm earned 0 total points
ID: 22819524
proposen to delete tius question bur award you the points ....
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand column That will then direct you to their download page. From that p…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses

770 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