SRL Archive - Bugs

Genuine bugs concerning arrays


Cigue

2010-08-04 19:27:18

1.
TPointArray1 := [blablabla];
TPointArray2 := TPointArray1;
SortTPAFrom(TPointArray1, TPointArray1[0]);

Both arrays end up sorted.

2. Copying a global BMP into a local BMP then freeing the local one also frees the global one.

nielsie95

2010-08-04 19:29:23

The first is not a bug, an array is a pointer. I'm not sure what you mean by the second, could you give me an example?

Cigue

2010-08-04 19:35:54

From: nielsie95
The first is not a bug, an array is a pointer. I'm not sure what you mean by the second, could you give me an example?


Thanks for the first one, I didn't know that :P As for the second one, I have not experience it myself, but I feel the mechanics of it are the same.

nielsie95

2010-08-04 20:07:25

Ok, just keep in mind that you cannot copy a pointer (like an array, object, bitmap or dtm) just by assigning it to another variable.

Wanted

2010-08-04 20:24:55

I have no idea how that hasn't caused over 9000 problems with the first thing.

nielsie95

2010-08-04 20:56:51

Remember that if you change the length of one the arrays, they are not the same array any more.

Cigue

2010-08-04 21:34:01

From: nielsie95
Remember that if you change the length of one the arrays, they are not the same array any more.


If I put it in SetArrayLength() but don't change the length will it work too?

Nava2

2010-08-04 23:04:11

I would hope not, that would be terribly inefficient..

nielsie95

2010-08-06 09:57:02

Looks like it does, though (if I look at the code).