I have something like this:
PStruct = ^Struct;
Struct = record
num: integer;
end;
I have a unit to handle that structure ( is a bit more complicated, but
is a good example), in this unit I have a procedure that deletes (
disposes ) the pointer. How can I know if a pointer a
You can assign "nil" to the pointer before using it, then check if PStruct =
nil it wasn't
created.
Leonardo.
--- Zaka E-Lab <[EMAIL PROTECTED]> wrote:
> I have something like this:
>
> PStruct = ^Struct;
> Struct = record
> num: integer;
> end;
>
> I have a unit to ha
Maybe I haven't explain it correctly. What I want is to construct a
Unit that contains some procedures, one of them is
create(var p : PStruct), and other is delete(var p : PStruct).
I don't create anything, the memory is allocated by the create
procedure. How can the procedure know if the argumen
On 29 Apr 2008, at 14:48, Zaka E-Lab wrote:
I don't create anything, the memory is allocated by the create
procedure. How can the procedure know if the argument is a pointer
already allocated or not?
It cannot know that without help. You have to do such bookkeeping
yourself (e.g., as mentio
It's possible to give a default initialization value to a defined type?
I suppose that it isn't, but it would be to easy to resolve that trouble
that way.
Anyway, I appreciate your help and support.
Thanks.
Zaka.
Jonas Maebe escribió:
It cannot know that without help. You have to do such book
On 29 Apr 2008, at 15:35, Zaka E-Lab wrote:
It's possible to give a default initialization value to a defined
type?
No, that is not possible.
Jonas
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/li
Jonas Maebe wrote:
On 29 Apr 2008, at 15:35, Zaka E-Lab wrote:
It's possible to give a default initialization value to a defined type?
No, that is not possible.
Except if your pointer is declared as a member of a class (which is
always assigned to nil by default)
___
Joao Morais wrote:
Jonas Maebe wrote:
On 29 Apr 2008, at 15:35, Zaka E-Lab wrote:
It's possible to give a default initialization value to a defined type?
No, that is not possible.
Except if your pointer is declared as a member of a class (which is
always assigned to nil by default)
Hans MÃ¥rtensson wrote:
But that would not work after the pointer was used and then it's
memory freed.
So a better way might be:
Always when declaring pointers do it this way:
var p: ^sometype = nil;
Then in stead of using the freemem, define your own procedure:
procedure myfreemem(var p: p
Alan Krause wrote:
Hans MÃ¥rtensson wrote:
But that would not work after the pointer was used and then it's
memory freed.
So a better way might be:
Always when declaring pointers do it this way:
var p: ^sometype = nil;
Then in stead of using the freemem, define your own procedure:
procedur
On Wed, 30 Apr 2008 01:22:47 +0200
Marc Weustink <[EMAIL PROTECTED]> wrote:
> Alan Krause wrote:
> > Hans MÃ¥rtensson wrote:
> >> But that would not work after the pointer was used and then it's
> >> memory freed.
> >> So a better way might be:
> >>
> >> Always when declaring pointers do it this
11 matches
Mail list logo