美文网首页
知识点5:神奇数字(magic number)

知识点5:神奇数字(magic number)

作者: BryantHe | 来源:发表于2017-03-13 20:22 被阅读79次

watch out! Don't put a semicolon at the end of your #defines.

You'll notice here also that I frequently #define all my defined symbolic constants, so to speak, are always in all caps.

It's a convention. It's not required.

The reason generally people will use all capitals when they're #defining is just to make it really clear that this particular element of my code is a defined constant. If it was lowercase, it's possible that it might be confused with a variable. And that's probably not a good thing to do.

相关文章

网友评论

      本文标题:知识点5:神奇数字(magic number)

      本文链接:https://www.haomeiwen.com/subject/jrpqnttx.html