Wolf Behrenhoff wrote:
>
.... snip ...
>
> I didn't look at fpc - but Turbo Pascal does the following when
> foo is called:
> - it pushes the number to the stack
> - it pushes the address of the string (so, you're right, it is
> passed by reference; also in case a). BUT the foo procedure itself
> then does a "sub sp, sizeof(str)" and copies the string. But that is
> just an internal detail, I don't know if FPC does it the same way.
TP has the unexpected habit of copying many strings to the stack,
including undeclared buffers. This can cause stack overflows,
especially when the procedure is recursive.
--
<http://www.cs.auckland.ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfocus.com/columnists/423>
"A man who is right every time is not likely to do very much."
-- Francis Crick, co-discover of DNA
"There is nothing more amazing than stupidity in action."
-- Thomas Matthews


|