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.


>  Lastly, passing by reference rather than by value is much faster.
>  Since copies need not be made when entering a method when entered

OK, so this is only a benefit then if you use Arrays. If I had to use
a simple data class (class with no methods), then I can simply pass it
as normal or via 'var' parameters and get the same result as you
mentioned.


-- 
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net/fpgui/
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to