[fpc-pascal] Self pointer existence

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Apr 18 10:15:49 CEST 2011


On Mon, 18 Apr 2011 09:54:28 +0200
Wimpie Nortje <wimpienortje at gmail.com> wrote:

> Hi
> 
> When does the self pointer's value become valid?

In NewInstance, so before the constructor is called.

 
> I need a reference to the object being created inside the object's own
> create method. The last statement in Create uses self, but that causes
> program crashes.
> 
> Is this too early to use self? Is there another way?

There is probably a bug in your code, but without seeing the code
there is no way to tell.

Mattias



More information about the fpc-pascal mailing list