leetcode遇到的错误

各种内存错误

AddressSanitizer: stack-overflow on address 0x7fff4d466ff8 (pc 0x0000004122c9 bp 0x7fff4d467030 sp 0x7fff4d466ff0 T0)
这种一般是系统栈溢出了,可能是因为无限递归导致的,应该检查一下递归条件是不是不合适。

runtime error: reference binding to misaligned address 0xbebebebebebec0ba for type ‘int’, which requires 4 byte alignment (stl_deque.h)
0xbebebebebebec0ba: note: pointer points here

指针乱指!例如栈为空时调用top()函数,会导致越界报错

stack<int> s;
s.top();    //这样会导致编译出错

函数错误

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章