gpt4 book ai didi

c++ - 为了清晰起见,是否应该经常跳过捷径、简洁和聪明?

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:03:11 28 4
gpt4 key购买 nike

看到这段简单的代码后想到了这个问题:

if (!x%y)
{
// do something
}

也许这是早期 C 书籍(K&R?)的影响,但如果不是那么可爱,是否总是首选以下内容?

if (x%y != 0)
{
// do something
}

最佳答案

This quote回答你的问题。

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." – Brian W. Kernighan

关于c++ - 为了清晰起见,是否应该经常跳过捷径、简洁和聪明?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4239549/

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