Open
Description
static const char* const
may be replaced with static const char[]
. It allows to use sizeof(arr)
or better ARRAY_SIZE(arr)
to compute the length instead of using strlen(arr)
at runtime. Alternatively it could be static const std::string_view
with modern CPP.
For function locals, const char[]
is not automatically the better choice, because that will copy the data string into the stack.
static const char*
(as opposed to static const char* const
) may need to stay if it is reassigned to different strings at runtime (the compiler will tell).
Raised by Caball009