如果我們把這個例子:結束迭代器和分段錯誤
std::map<int,foo*> intmap;
fillMap(intmap);
// I will force this to end(), in real life this could be a "find" output
std::map<int,foo*>::iterator iter = intmap.end();
if(iter->second != 0)
iter->second->whatever();
我有段錯誤(這是預期的,例如不檢查「!ITER = intmap.end()」 故意)在「whatever()」調用上但不在「 - > second」空指針檢查上:它是預期的行爲嗎?這個seg會在「whatever()」調用中系統地出錯,還是依賴於特定的運行時間內存條件?
在此先感謝您的意見。 賈科莫