考慮這個方法:什麼可能導致`MyType * pType`從有效參數中返回之前返回null?
result MyClass::getBMPText(Osp::Graphics::Bitmap *pBMP, Osp::Base::String &outtext, const int index) const {
//Do stuff
AppLog("3 Returning %S, 0x%X", outtext.GetPointer(), (int)pBMP);
return E_SUCCESS;
}
我這樣稱呼它:
String itemstr;
Bitmap *pBMP = null;
for (int i = 0; i < ItemCount(); ++i) {
getBMPText(pBMP, itemstr, i);
AppLog("got %d : %S 0x%X", i, itemstr.GetPointer(), (int)pBMP);
}
現在看看日誌:
5537.642,INFO,P35,T00,A190, FileMan :: getBMPText(401)> 3返回圖像,0xB96E2140 5537.643,INFO,P35,T00,A190,FileMan :: Update1p2List(130)>獲得0:圖像0x0
要重複我的問題/觀察:該函數將其返回值記錄爲有意義且相關的剛設置它。然而,客戶端取回了它發送的相同的空引用。
' printf' – John 2012-02-04 00:26:14