Disallowing creation of the temporary objects

后端 未结 8 927
南方客
南方客 2020-11-29 09:01

While debugging crash in a multithreaded application I finally located the problem in this statement:

CSingleLock(&m_criticalSection, TRUE);
8条回答
  •  执念已碎
    2020-11-29 09:51

    I don't think so.

    While it's not a sensible thing to do - as you've found out with your bug - there's nothing "illegal" about the statement. The compiler has no way of knowing whether the return value from the method is "vital" or not.

提交回复
热议问题