您的位置:首页 > 编程语言 > C语言/C++

Adivce from the father of C++

2007-03-18 17:59 441 查看
Advice
[1] Use namespaces to express logical structure;
[2] Place every nonlocal name,except main(),in some namespcace;
[3] Design a namespace so that you can conveniently use it without accidentally gaining accessing to unrelated namespaces;
[4] Avoid very short names for namespaces;
[5] If necessary,use namespace aliases to abbreviate long namespaces;
[6] Avoid placing heavy notational burdens on users of your namespaces;
[7] Use the Namespace::member notation when defining namespace members;
[8] Use using namespace only for transition or within a local scope;
[9] Using exceptions to decouple the treatment of "errors" from the code dealing with the ordinary processing;
[10]Use user-defines rather than bulit-in types as exceptions;
[11]Don't use exceptions when local control structures are sufficient.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  c++ 职场 休闲