Home  >  Q&A  >  body text

c++ - 大家对标识符起名有什么心得和素材吗?

最近命名标识符老用那几个,容易冲突也觉得不优雅。有没有一些比较实用素材给共享一下。

巴扎黑巴扎黑2765 days ago815

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2017-04-17 13:02:05

    What is an identifier? For the time being, I understand it as a variable name or function name.
    You can refer to Chapter 11 of "Code Encyclopedia".

    I think, first of all, use English, not Pinyin...and don’t use minority languages.
    Try to keep variable names as short as possible, but use abbreviations with caution.
    Distinguish variable types, corresponding to word parts of speech; variables use nouns, and functions use verbs or phrases. This actually requires a very high level of English.

    Read "Code Encyclopedia", there are many examples in the book.

    reply
    0
  • Cancelreply