What are the most common naming conventions in C?

前端 未结 11 2358
走了就别回头了
走了就别回头了 2020-12-02 04:13

What are the naming conventions commonly use in C? I know there are at least two:

  1. GNU / linux / K&R with lower_case_functions
  2. ? name ? with UpperC
11条回答
  •  春和景丽
    2020-12-02 04:28

    You should also think about the order of the words to make the auto name completion easier.

    A good practice: library name + module name + action + subject

    If a part is not relevant just skip it, but at least a module name and an action always should be presented.

    Examples:

    • function name: os_task_set_prio, list_get_size, avg_get
    • define (here usually no action part): OS_TASK_PRIO_MAX

提交回复
热议问题