[Haskell-cafe] Learning C after Haskell
duncan.coutts at worc.ox.ac.uk
Mon Jun 12 18:03:27 EDT 2006
On Mon, 2006-06-12 at 14:48 -0700, Jared Updike wrote:
> > Thanks, Minh. So are things like recursion and memory sharing typically out
> > the window?
> Recursion works in C, but every function call pushes stack, so
> recursive depth is limited by RAM (compare to tail call optimization
> in many functional programming languages where the stack frame is
> reused if code is written iteratively with an accumulator). Most of
> the time for performance (and to be idiomatic) in C you will just
> write for and while loops and modify state in place. Welcom to C.
GCC can do a limited tail-call optimisation these days. It covers the
obvious self tail call case and I believe some less trivial cases but
it's not as comprehensive as in a typical functional language compiler.
More information about the Haskell-Cafe