知識點5:神奇數字(magic number)

weixin_34054866發表於2017-03-13
951896-2d1be3fc90f4fdbb.png

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.

相關文章