Jun 28th, 2009 Posted in C\C++ | No Comments »
Part 1: Building Stable Systems
1. Exception Handling
有两个特点:
- 错误处理代码不再繁琐
- 错误不会漏掉
Traditional error handling
- 使用函数返回值,或者全局错误变量,繁琐。
- 使用很少人知道的标准C库函数signal(),需要合理的信号处理机制,不适用于大工程。
- 使用全局的goto即stjmp()和longjmp()
后两者有共同的缺点:不会调用析构函数,对象不能有效地清除。
Read the rest of this entry »
Tags: C++, exception handling
Jun 4th, 2008 Posted in C\C++ | No Comments »
Tags: cdecl, DLL, stdcall, 动态链接库
Mar 19th, 2008 Posted in C\C++ | 1 Comment »
用C++有几年了,对网上”C++ is dying”的论调不可能充耳不闻。is C++ dying or not? 轮不到自己去评论,引用某些人的观点:
C++ is dying, and it has nothing much to do with technology. Like everything in software, it is about the people. C++ is loosing good programmers. When good programmers are gone, C++ is dead.
Read the rest of this entry »
Tags: C++
Nov 29th, 2007 Posted in C\C++ | No Comments »
用了C和C++这么久,对于二者的一些细节还真是不知道,难得今天有空儿,补一补。先来谈谈C standard library。
The C standard library is a now-standardized collection of header files and library routines used to implement common operations, such as input/output and string handling, in the C programming language. Unlike other languages such as COBOL, Fortran, and PL/I, C does not include builtin keywords for these tasks, so nearly all C programs rely on the standard library to function.
Read the rest of this entry »
Tags: C standard library, Run-Time Library