[llvm-dev] RFC: Constructing StringRefs at compile time

Malcolm Parsons via llvm-dev llvm-dev at lists.llvm.org
Mon Nov 28 07:07:20 PST 2016


On 25 November 2016 at 12:34, Malcolm Parsons <malcolm.parsons at gmail.com> wrote:
> MSVC 2015 doesn't support C++14 extended constexpr. I don't know how
> well it optimises a recursive strlen.

It's not as good at tail recursion optimisation as Clang, but it does
handle this:

constexpr size_t llvm_strlen(const char* s, size_t l = 0) {
  return *s ? llvm_strlen(s + 1, l + 1) : l;
}

Is stack usage in unoptimised builds an issue?

-- 
Malcolm Parsons


More information about the llvm-dev mailing list