gpt4 book ai didi

c++ - "const"声明有助于编译器 (GCC) 生成更快的代码吗?

转载 作者:可可西里 更新时间:2023-11-01 18:06:01 25 4
gpt4 key购买 nike

<分区>

const 声明是否有助于编译器 (GCC) 生成更快的代码,还是它们仅对可读性和正确性有用?

Zed Shaw 认为 const 在 C/C++ 中没有用或被过度使用:

Next is all the bizarre fascination with const. For some odd reason C++ loves to make you slap const on every part of a declaration, and yet I get the same end result as C: a function is called. (...)

(来自:http://librelist.com/browser//mongrel2/2010/7/15/c-verses-c++/#770d94bcfc6ddf1d8510199996b607dd)

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com