As they are declared static, I think the compiler will optimize out the
pointer storage and lookup completely so there should be no wasted space or
pointer indirection.


On Tue, Jul 16, 2013 at 6:42 AM, Jonathan Sauer <[email protected]>wrote:

> 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.
>
> _______________________________________________
> cfe-commits mailing list
> [email protected]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>



-- 
~Craig
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to