[Exceptional C++ Style] Exceptional C++ Style - Item 24: Constant Optimization

Ric Parkin ric.parkin at ntlworld.com
Mon Jan 24 07:36:39 EST 2005


From: David Nash <David.Nash at WallStreetSystems.com>
> The only way using "const" can help the compiler, is when defining something
> const.  Then it could potentially be put into read-only memory.  Personally
> I'm dubious even about this - const_cast (or plain old "C"-style cast) can
> still be used in this case.

Except that would invoke the dreaded Undefined Behaviour.

See 7.1.5.1/4

Ric

-----------------------------------------
Email provided by http://www.ntlhome.com/


-----------------------------------------
Email provided by http://www.ntlhome.com/





More information about the Effective-cpp mailing list