C++ debug tips

    技术2022-05-19  26

    // implement asio-base file transfer software

     

    1)client request without connect ..->connect(); //async_connect not ok yet!!! ..->request_file(); ios.run().. 2) string str; error: boost::asio::buffer(str); ok: boost::asio::buffer(str.data(), str.length()); 3) server/session MUST use shared_from_this() in async_read_until(... shared_from_this()... because in server, it use shared_ptr<session> ????

     

    *************************************************************** struct char array member should be init before doing copy *************************************************************** struct ITEM {     char szName[128];     int nQty; }; ITEM obj; obj.nQty = 10; vector<ITEM> data; data.push_back(obj); //!!! exception *************************************************************** struct contain non-primitive type can't do memcpy(). *************************************************************** struct SgOrder {     vector<ITEM> m_execData; }; it will raise exception when using m_execData and object destruction


    最新回复(0)