Programming 版 (精华区)
发信人: netiscpu (说不如做), 信区: Programming
标 题: C++ 编程准则与忠告 之 General Recommendations
发信站: 紫 丁 香 (Sun Jul 26 11:08:27 1998), 转信
General Recommendations
Back to index
Rec. 1 Optimize code only if you know that you have a performance
problem. Think twice before you begin.
Rec. 2 If you use a C++ compiler that is based on Cfront, always
compile with the +w flag set to eliminate as many warnings as
possible.
Various tests are said to have demonstrated that programmers generally
spend a lot of time optimizing code that is never executed. If your
program is too slow, use gprof++ or an equivalent tool to determine
the exact nature of the problem before beginning to optimize.
Code that is accepted by a compiler is not always correct (in
accordance with the definition of the C++ language). Two reasons for
this are that changes are made in the language and that compilers may
contain bugs. In the short term, very little can be done about the
latter. In order to reduce the amount of code that must be rewritten
for each new compiler release, it is common to let the compiler
provide warnings instead of reporting errors for such code until the
next major release. Cfront provides the +w flag to direct the compiler
to give warnings for these types of language changes.
--
Enjoy Linux!
-----It's FREE!-----
※ 来源:.紫 丁 香 bbs.hit.edu.cn.[FROM: mtlab.hit.edu.cn]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:5.342毫秒