Graeme Geldenhuys wrote:
On 11/10/2009, Andrew Brunner <andrew.t.brun...@gmail.com> wrote:
 FPC forces the ^ operator while accessing structures as pointers.
 Delphi didn't force it and I even suspect that memory leaks can result
 in NOT using the ^ to denote the reference to the pointer rather than
 the pointer itself.

This was just discussed in another thread. This is not always forced by FPC.
eg:

var
  S:  TMyArray;
  pS: ^TMyArray;

then use them as follows:

  S[2]
  pS[2]

Both work just fine without dereferencing the second line. Weird
behaviour, but true.

However they have a different meaning.

assume TMyArray=array[1..10] of Byte;

then S[2] refers to the second element of S, being the second byte, while pS[2] refers to the 3 element of pS, being the 3rd TMyArray


Marc

_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to