双下划线在年初含义 [英] Meaning of double underscore in the beginning

查看:139
本文介绍了双下划线在年初含义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在标准库(glibc的)我看到 SYS / mman.h __ MMAP C $ C>。什么目的?我们怎么还调用函数 MMAP 这似乎并没有在任何地方声明。我的意思是,我们包括 SYS / mman.h 对于这一点,但 SYS / mman.h 未声明 MMAP ,它宣称只有 __ MMAP

In the standard library (glibc) I see functions defined with leading double underscores, such as __mmap in sys/mman.h. What is the purpose? And how can we still call a function mmap which doesn't seem to be declared anywhere. I mean we include sys/mman.h for that, but sys/mman.h doesn't declare mmap, it declares only __mmap.

推荐答案

从GNU手册:

在除本手册中介绍的名称,保留名称
  包括所有外部标识符(全局函数和变量)
  以下划线(_)和所有标识符开始不管用
  与任何两个下划线或下划线后跟一个开始
  大写字母被保留名称。这是为了使该库和
  头文件可以定义函数,变量和宏内部
  目的,而无需在用户程序名称冲突的风险。

In addition to the names documented in this manual, reserved names include all external identifiers (global functions and variables) that begin with an underscore (‘_’) and all identifiers regardless of use that begin with either two underscores or an underscore followed by a capital letter are reserved names. This is so that the library and header files can define functions, variables, and macros for internal purposes without risk of conflict with names in user programs.

这是它也使用C和C ++供应商的约定。

This is a convention which is also used by C and C++ vendors.

这篇关于双下划线在年初含义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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