Programming 版 (精华区)
发信人: netiscpu (说不如做), 信区: Programming
标 题: C++ 编程准则与忠告 之 Introdution
发信站: 紫 丁 香 (Sun Jul 26 11:06:50 1998), 转信
1 Introduction
Back to index
The purpose of this document is to define one style of programming in
C++. The rules and recommendations presented here are not final, but
should serve as a basis for continued work with C++. This collection
of rules should be seen as a dynamic document; suggestions for
improvements are encouraged. A form for requesting new rules or
changes to rules has been included as an appendix to this document.
Suggestions can also be made via e-mail to one of the following
addresses:
erik.nyquist@eua.ericsson.se
mats.henricson@eua.ericsson.se
Programs that are developed according to these rules and
recommendations should be:
- correct
- easy to maintain.
In order to reach these goals, the programs should:
- have a consistent style,
- be easy to read and understand,
- be portable to other architectures,
- be free of common types of errors,
- be maintainable by different programmers.
Questions of design, such as how to design a class or a class
hierarchy, are beyond the scope of this document. Recommended books on
these subjects are indicated in the chapter entitled "References".
In order to obtain insight into how to effectively deal with the most
difficult aspects of C++, the examples of code which are provided
should be carefully studied. C++ is a difficult language in which
there may be a very fine line between a feature and a bug. This places
a large responsibility upon the programmer. In the same way as for C,
C++ allows a programmer to write compact and, in some sense,
unreadable code.
Code written in bold type is meant to serve as a warning. The examples
often include class definitions having the format "class {};". These
are included so that the examples may be compiled; it is not
recommended that class definitions be written in this way. In order to
make the code more compact, the examples provided do not always follow
the rules. In such cases, the rule which is broken is indicated.
Many different C++ implementations are in use today. Most are based on
the C++ Language System by AT&T. The component of this product which
translates C++ code to C is called Cfront. The different versions of
Cfront (2.0, 2.1 & 3.0 are currently in use) are referred to in order
to point out the differences between different implementations.
Rule 0 Every time a rule is broken, this must be clearly documented.
--
Enjoy Linux!
-----It's FREE!-----
※ 来源:.紫 丁 香 bbs.hit.edu.cn.[FROM: mtlab.hit.edu.cn]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:1.948毫秒