September 27, 2001
a wrote:

> Can you pass around pointers to functions in pascal?  I don't know pascal well enough to know.

Yes you can.

> If so, did they try to do something to keep
> the user from returning a pointer to the nested function?

Very interesting question, indeed.

I just tried it out. At least in
'GNU Pascal version 19991030, based on 2.95.2 19991024 (release)'
nothing prevents you from doing this. If you access arguments in the inner
function from the outer one you get random results :(

Might be worth checking out on newer release / reporting on their mailing list.

> I don't think
> any C based language should have to, but I always got the impression
> that the pascal based languages tried to keep the programmer from
> shooting himself in the foot at (almost) any expense.

Well pascal tried that, but didn't really succeed. You can also as good call a function pointer holding yet null. However might be interesting that java is in principle C based and yet keeps you 100% assured not to reach your foot anyway, or to see it at all :o)

- Axel

\
|D> http://www.dtone.org
/

September 29, 2001
Axel Kittenberger wrote:
> > I don't think
> > any C based language should have to, but I always got the impression
> > that the pascal based languages tried to keep the programmer from
> > shooting himself in the foot at (almost) any expense.
> 
> Well pascal tried that, but didn't really succeed. You can also as good call a function pointer holding yet null. However might be interesting that java is in principle C based and yet keeps you 100% assured not to reach your foot anyway, or to see it at all :o)

Well, I'll agree that java won't let you see your foot, but I'll go with http://www.claessens16.yucom.be/howto.htm as to shooting yourself in the foot:

Java
The gun fires just fine, but your foot can't figure out what the bullets
are and ignores them.


http://duff.geology.washington.edu/mdbrg/staff_pages/shootfoot.html and http://compsoc.ucc.ie/joke14.html kind of agrees with you though:

Java: You can do it with a standalone interpreter, but a java applet will not let you access your foot.

Java The Java Verifier will not allow you to handle a Gun.

Dan
1 2
Next ›   Last »