相关疑难解决方法(0)

在C++标识符中使用下划线有哪些规则?

在C++中通常用某种前缀命名成员变量来表示它们是成员变量而不是局部变量或参数.如果你来自MFC背景,你可能会使用m_foo.我myFoo偶尔也见过.

C#(或者可能只是.NET)似乎建议只使用下划线,如_foo.这是否允许C++标准?

c++ standards naming-conventions c++-faq

906
推荐指数
4
解决办法
24万
查看次数

C中最常见的命名约定是什么?

C中常用的命名约定是什么?我知道至少有两个:

  1. 具有lower_case_functions的GNU/linux/K&R
  2. ?名称 ?使用UpperCaseFoo函数

我只在这里谈论C.我们的大多数项目都是使用C的小型嵌入式系统.

这是我计划用于下一个项目的那个:


C命名惯例

Struct              TitleCase
Struct Members      lower_case or lowerCase

Enum                ETitleCase
Enum Members        ALL_CAPS or lowerCase

Public functions    pfx_TitleCase (pfx = two or three letter module prefix)
Private functions   TitleCase
Trivial variables   i,x,n,f etc...
Local variables     lower_case or lowerCase
Global variables    g_lowerCase or g_lower_case (searchable by g_ prefix)
Run Code Online (Sandbox Code Playgroud)

c naming-conventions

114
推荐指数
8
解决办法
14万
查看次数

标签 统计

naming-conventions ×2

c ×1

c++ ×1

c++-faq ×1

standards ×1