1.1 - [intro.scope] - 【介绍.范畴】

请不要转载本文;请不要以任何形式重新出版,发布本文;请在下载本文 24 小时内将其删除;禁止将本文用于商业目的。

1 General [intro]

1.1 Scope [intro.scope]

 

1 综述 【介绍】

1.1 范畴 【介绍.范畴】

 

This International Standard specifies requirements for implementations of the C++ programming language. The first such requirement is that they implement the language, and so this International Standard also defines C++. Other requirements and relaxations of the first requirement appear at various places within this International Standard.

 

本国际标准规定了实现 C++ 程序设计语言的规格要求。其中的首要规格要求就是实现语言本身,因此本国际标准同样定义了 C++ 语言。在本国际标准中也广泛分布了其他的规格要求和对首要规格要求的弱化。

 

C++ is a general purpose programming language based on the C programming language as described in ISO/IEC 9899:1990 Programming languages - C (1.2). In addition to the facilities provided by C, C++ provides additional data types, classes, templates, exceptions, namespaces, inline functions, operator overloading, function name overloading, references, free store management operators, and additional library facilities.

 

C++ 是一种以由 ISO/IEC 9899:1990 程序设计语言 - C(1.2)中描述的 C 程序设计语言为基础的通用程序设计语言。除了在 C 中提供的设施之外,C++ 提供了额外的数据类型,类,模板,异常,名字空间,内联函数,运算符重载,函数名重载,引用,自由存储管理运算符,以及额外的库设施。

 

PREV [intro] | NEXT [intro.refs]上一页 【介绍】 | 下一页 【介绍.参考】
<think>好的,用户想在Emacs中自定义C编程风格配置。我需要先回忆一下Emacs相关的配置方法。根据引用[3]提到的,用户可以通过修改配置文件来设置编译快捷键,比如F7绑定到编译命令。这可能涉及到hook函数和键位绑定。 首先,C编程风格通常与cc-mode相关,Emacs使用cc-mode来支持C、C++语言的模式。自定义编程风格需要配置变量`c-style-variables`,可能还需要设置hook函数,比如`c-mode-common-hook`,在进入C模式时自动应用配置。 用户可能需要设置缩进、括号样式、注释格式等。例如,设置缩进为4个空格,使用Linux风格的括号换行方式。这些可以通过在.emacs文件中添加配置来实现。例如,使用`c-set-style`选择基础风格,然后调整其他变量如`c-basic-offset`。 另外,引用[3]中提到在`my-c-mode-common-hook`函数里定义键位,这说明用户可能需要编写一个hook函数来应用这些配置。所以步骤可能包括:定义自定义样式,创建hook函数来应用该样式,并将hook添加到`c-mode-hook`中。 还要考虑是否使用已有的样式作为基础,比如"gnu"或"linux",然后进行微调。用户可能希望自定义的样式有自己的名字,这可以通过`c-add-style`来实现。 最后,确保配置正确加载,可能需要重启Emacs或重新加载配置文件。另外,用户可能对如何测试配置和验证缩进效果有疑问,所以生成的问题可以包括这些方面。</think>在Emacs中自定义C编程风格配置可通过以下步骤实现: ### 一、基础配置框架 1. 在`~/.emacs`或`~/.emacs.d/init.el`中添加: ```lisp (add-hook 'c-mode-common-hook (lambda () (c-set-style "mystyle") ; 自定义风格名称 (setq c-basic-offset 4))) ; 基础缩进量 ``` ### 二、自定义编程风格 2. 使用`c-add-style`创建新风格(示例包含5个关键参数): ```lisp (c-add-style "mystyle" '((c-basic-offset . 4) ; 4空格缩进 (c-comment-only-line-offset . 0) (c-offsets-alist ; 语法元素缩进规则 (arglist-intro . +) (statement-cont . +) (substatement-open . 0) (case-label . +) (inline-open . 0) (block-open . 0)) (c-hanging-braces-alist ; 括号悬挂规则 (defun-open after) (defun-close before) (class-open after) (inline-open after) (block-open after)))) ``` ### 三、高级配置示例 3. 强制K&R括号风格并添加自动格式化: ```lisp (setq c-default-style "mystyle" c-auto-newline t c-tab-always-indent t indent-tabs-mode nil) ; 禁用制表符 ``` ### 四、快捷键绑定(参考引用[3]) 4. 在hook中添加编译快捷键: ```lisp (define-key c-mode-base-map [(f7)] 'compile) ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值