forked from electronicarts/CnC_Generals_Zero_Hour
-
Notifications
You must be signed in to change notification settings - Fork 84
Open
Labels
InvestigateMinorSeverity: Minor < Major < Critical < BlockerSeverity: Minor < Major < Critical < BlockerPerformanceIs a performance concernIs a performance concernRefactorEdits the code with insignificant behavior changes, is never user facingEdits the code with insignificant behavior changes, is never user facing
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
Metadata
Metadata
Assignees
Labels
InvestigateMinorSeverity: Minor < Major < Critical < BlockerSeverity: Minor < Major < Critical < BlockerPerformanceIs a performance concernIs a performance concernRefactorEdits the code with insignificant behavior changes, is never user facingEdits the code with insignificant behavior changes, is never user facing