len3d

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

I always assume that 'static const' is faster than 'const', while it's actually not the case.

 

From the assembly code generated by VS 2008, 'static const' will generate a dynamic branch to make sure the variable is only initialized once. However, 'const' will generate a real constant.

 

 

posted on 2012-11-15 16:46  Len3d  阅读(184)  评论(0编辑  收藏  举报