Re: newbie exploring better ways



On Jan 30, 5:16 am, Maciej Katafiasz <mathr...@xxxxxxxxx> wrote:
This is absolutely untrue. TCO is not mandated by the language standard,
therefore relying on it is like writing code that depended on certain
variables being elided by the compiler in optimisation phase. It's been
discussed many times here; TCO is not just something you drop into your
code and merrily go your way, it depends on any number of factors and
.. snip ..
It's okay to present a recursive solution for its conceptual elegance,
but it's utterly and completely wrong to present it without appropriate
disclaimers about inherent limitations, or claim that these limitations
are just a matter of using a better compiler. They're not.


That's a very good point. While the CL compiler I use daily (Allegro)
does it (I use CLISP periodically and thought it does it, I thought
most do, I could be very wrong), regardless I have probably grown to
count on it a little more than I should - as you are right it's not
something that is guaranteed or specified. When available though, I'm
going to use all the tools in my box.

And then, if it doesn't, or it's slow, when I profile it, I will see
that. If I can write a simple 3 line tail recursive version (when the
others seem longer or more difficult to conceive), I'm probably going
to write it, because it's fast to write and easy to maintain. If the
profiler says it is (too) slow, I'll change it when, and if, it's a
problem.

Thanks for not letting me reinforce only part of the story.
.



Relevant Pages

  • Re: namespaces and main()
    ... > You're not writing code twice, just declarations. ... information for the linker to check if any exported type information ... again lack of adequate information passed from the compiler to ...
    (comp.lang.cpp)
  • [PATCH v2] check spinlock_t/rwlock_t argument type on non-SMP builds
    ... When writing code for UP without CONFIG_DEBUG_SPINLOCK it's easy to get ... the first argument to the spinlock/rwlock functions wrong. ... Change the intermediate macros into inline functions. ... on generated code (assuming the compiler is listening). ...
    (Linux-Kernel)
  • Re: c# interview question
    ... uses the ToString() method anyway. ... between the two would have been optimized away by the compiler, ... If you're writing code where these differences are ... significant, use C or C++, or even Assembly language. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: best evm for virtex-4 and linux
    ... I've written a lot of code that ran without memory protection ... a compiler with strong type checking and that excludes ... I was writing code ... Please do not send unsolicited bulk e-mail or unsolicited ...
    (comp.arch.fpga)
  • Re: [patch 00/2] improve .text size on gcc 4.0 and newer compilers
    ... I would really want to see some program in gcc package that takes source code and some profile results and tries to suggest some annotations for the code like ... It also should warn if it finds annotations already in the code that don't match profile results. ... Also it can make debuging strange problems (that can be caused by buggy compiler) much harder because everyone can have completly different binary code generated by their compiler because completly different profile was used. ...
    (Linux-Kernel)