This is not necessarily a bad thing. Tail recursion is always equivalent to a loop, and writing a loop can obviously be more efficient, depending on the compiler. (*) Modern compilers, such as GCC, can optimize tail recursion, but they do not always recognize it. When they do not see this, recursion will consume stack space.
Thus, an algorithm such as quicksort is naturally expressed recursively, and one of its two recursions is tail recursion. I would write it recursively on the first pass, and then rewrite it as a loop if I found that it was too slow.
When an algorithm has only one recursion, which is tail recursion, it might still be a good idea to write it as a loop right away, because recursive functions can be harder to debug than loops.
(*) I assume that we are talking only about C. In some other languages, tail recursion can be considered as a natural loop method (functional languages) or direct abomination (Python).
source share