前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >C++核心准则​NL.10:首选下划线风格名称

C++核心准则​NL.10:首选下划线风格名称

作者头像
面向对象思考
发布2020-11-26 11:16:59
3900
发布2020-11-26 11:16:59
举报

NL.10: Prefer underscore_style names

NL.10:首选下划线风格名称

Reason(原因)

The use of underscores to separate parts of a name is the original C and C++ style and used in the C++ Standard Library.

下划线用于分隔名称的各个部分,是C和C ++的原始样式,并在C ++标准库中使用。

Note(注意)

This rule is a default to use only if you have a choice. Often, you don't have a choice and must follow an established style for consistency. The need for consistency beats personal taste.

此规则是默认值,仅在您可以选择时使用。通常,您别无选择,必须遵循既定风格来保持一致性。对一致性的需求高于个人品味。

This is a recommendation for when you have no constraints or better ideas. This rule was added after many requests for guidance.

当您没有约束或更好的想法时,这是一个建议。在许多准则的要求之后添加了此规则。

Example(示例)

Stroustrup: ISO Standard, but with upper case used for your own types and concepts:

Stroustrup:ISO标准,但大写字母用于您自己的类型和概念:

  • int
  • vector
  • My_map
Enforcement(实施建议)

Impossible.

不可能。

原文链接

https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#nl10-prefer-underscore_style-names

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2020-11-25,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 面向对象思考 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • NL.10: Prefer underscore_style names
  • Reason(原因)
    • Enforcement(实施建议)
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档