Alberto Narduzzi schrieb:
> Recursion is for other things, such as expression parsing etc. where you don't (and neither possibly can't) actually know how deep may the nesting.

Well, I would advice only to use it if you *know* the maximum nesting depth. Otherwise it can crash easily.

A good example of stack overflow crashes is a (Pascal) software happened in a huge railway signal box in germany (near Hamburg) in 1995 (http://catless.ncl.ac.uk/Risks/17.02.html#subj3). The software worked ok on testing but on go live it crashed with stack overflow because suddenly the data amount (and therefore the nesting depth) was significantly larger than in the tests. It is much harder to judge the stack memory use than the heap use and often the stack is more limited than the heap so you run into such issues easier.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply via email to