[Lazarus] Pointer woes when trying to port a Delphi program

Juha Manninen juha.manninen62 at gmail.com
Fri Aug 24 22:05:11 CEST 2012


On Fri, Aug 24, 2012 at 10:22 PM, brian <brian at meadows.pair.com> wrote:

> Type
>  TBtnPtr = ^TButton;
>  TBtnArray = Array [1..36] of TBtnPtr;
>

TButton is a reference type. Reference is basically a pointer which does
not require the pointer syntax.
You are really defining a pointer to pointer, a useless indirection there.
It makes things more difficult and you make errors more easily and may even
get a SIGSEGV :)

Do this instead:

type
TBtnArray = Array [1..36] of TButton;


Juha
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20120824/1353d690/attachment-0003.html>


More information about the Lazarus mailing list