r186383 - Add 'const' qualifiers to static const char* variables.

Jonathan Sauer jonathan.sauer at gmx.de
Tue Jul 16 06:42:36 PDT 2013


Hello,

> -static const char *StrEnteringLoop = "Entering loop body";
> -static const char *StrLoopBodyZero = "Loop body executed 0 times";
> +static const char *const StrEnteringLoop = "Entering loop body";
> +static const char *const StrLoopBodyZero = "Loop body executed 0 times";

Why not replace the pointers with arrays:

> static const char StrEnteringLoop[] = "Entering loop body";

That would avoid having to remember to add two const. It could even result
in slightly (very very slightly) faster code as it would remove a pointer
indirection.




More information about the cfe-commits mailing list