2011年5月17日
摘要: If you write “int i;” in C++, i’s type seems obvious: int. If you write “const int i;”, i’s type seems equally obviously to be const int. Often, these types are exactly what they seem to be, but sometimes they’re not. Under certain circumstances, C++ treats non-const types as const, and under others 阅读全文
posted @ 2011-05-17 17:28 sun_kang 阅读(377) 评论(0) 推荐(0) 编辑
摘要: Let's say that your program has a shared log file object. The log file is likely to be a popular object; lots of different threads must be able to write to the file; and to avoid corruption, we need to ensure that only one thread may be writing to the file at any given time.Quick: How would you 阅读全文
posted @ 2011-05-17 10:59 sun_kang 阅读(386) 评论(0) 推荐(0) 编辑