Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Misc > Re: Pointers in...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 789 of 818
Post > Topic >>

Re: Pointers in Pascal!!

by "Jochen" <jotel99@[EMAIL PROTECTED] > Apr 29, 2008 at 10:05 PM

hi!

Zaka E-Lab typed:
> 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 are created or
> not?, I mean, I don't wont to try to delete something that has not
> been created yet, but I don't know how to do it, if that is possible.

(Most) Pascal implementations do not initialize variables on creation.
So the value of the pointer variable is undefined. with normal pascal u
can only solve this by setting the variable to nil b4 u really use them.

ok, setting them to nil is usage already ... so if it was used at that
point u are still in trouble.

that'S why u should do that right after declaration (in execution order
of course) ;)

var p: pstruck;

begin
 p := nil
 ...
end;

greetz
jo

-- 
http://radio789.net.ms
- Radio 789 - We play it ALL
Radiostream: http://stream789.net.ms
 




 2 Posts in Topic:
Pointers in Pascal!!
Zaka E-Lab <shanatorio  2008-04-29 13:08:53 
Re: Pointers in Pascal!!
"Jochen" <jo  2008-04-29 22:05:15 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Oct 11 3:12:54 CDT 2008.