_函数名称中的下划线 [英] _Underscores in Function Names

查看:175
本文介绍了_函数名称中的下划线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在许多具有简单OO功能(PHP 4)或误解OO功能(使用函数指针等的Javascript,C)的语言中,您最终会得到一个使用前导下划线的函数命名约定来指示特权级别。

In a lot of languages with simple OO capability (PHP 4), or misunderstood OO capabilities (Javascript, C using function pointers, etc.), you'll end up with a function naming convention that uses leading underscores to to indicate privilege level.

//ex.
function _myPrivateFunction(){
}   

虽然个别团队总是会去提出了这样的命名惯例,下划线惯例似乎非常普遍,它让我很好奇

While individual teams are always going to come up with their own naming conventions like this, the underscore convention seems so prevalent that it made me curious about


  1. 技术首先来自哪里

  2. 如果在会议期间开发了任何标准化系统(有点像匈牙利表示法)

除了纯粹的好奇心,我现在正在处理的几个代码库中看到这个,我想了解最初提出它的开发人员可能的顶空。

Beyond pure curiosity, I'm seeing this in a few codebases I'm dealing with right now, and I'd like to understand the possible headspaces of the developers who originally came up with it.

推荐答案

在C ++世界中,以下划线开头的成员名称保留供编译器(或类似API的低级别STL)开发人员使用。编译器不以任何方式禁止它,但这是传统。

In C++ world, member names that start with underscore are reserved for use by compiler (or low level STL like API) developers. It's not prohibited by compilers in any way, but that's the tradition.

这个wiki链接在下划线

这篇关于_函数名称中的下划线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆