Monthly Archives: July 2009

Exception analysis – easy steps

When debugging an application, you can configure the debugger to break the process on an exception using sxe command. 0:000> sxe eh Now, you got an exception. The debugger shows a prompt something like this. (b34.fec): C++ EH exception – … Continue reading

Posted in Advanced Debugging | Leave a comment

GetCurrentProcess returns pseudo handle. Really.

The MSDN document on GetCurrentProcess API function is really wired. GetCurrentProcess Function Retrieves a pseudo handle for the current process. OK, what’s the "pseudo handle?" It actually explains it. A pseudo handle is a special constant, currently (HANDLE)-1, that … Continue reading

Posted in Tips | Leave a comment

Use IO Completion port to implement thread safe FIFO

Here is an example to implement thread safe FIFO using IO Completion port as a queue implementation. The implementation assumes there is only on thread pushing and another thread pulling. /*! A thread safe FIFO object with single thread push … Continue reading

Posted in Optimization | 1 Comment

std::string in VC++ may store a short string in a stack

The std::string object can store any length of string. However, it does not mean it always allocate char array on the heap. If you look into the type definition of std::string in VC++ 8.0, it has interesting array called _Bx::_Buf. … Continue reading

Posted in C++ | Leave a comment