# 札记

1. string a,b,c;

a=a+b; //error!

a+=b; //OK!

2011-11-03

Critical section并不是核心对象，因此没有所谓的handle这样的东西，它和核心对象不同，它存在于进程的内存空间中，不需要像Create这样的API函数获得一个 critical section handle, 你应该做的是一个类型为CRITICAL_SECTION的局部变量初始化，方法是调用InitializeCriticalSection():

HANDLEs are intentionally opaque representations that provide encapsulation and abstraction from internal Win32 resources. This way, the Win32 APIs could potentially change the underlying type behind a HANDLE, without it impacting user code in any way (at least that's the idea).

The handles in these example are really just a new, presumably friendlier, name for void *, which is exactly what a HANDLE is in the Win32 API (look it up at MSDN). It provides an opaque wall between the user code and the Win32 library's internal representations that increases portability, between versions of Windows, of code that uses the Win32 API.

• 写评论