I want to know how to interpret 0xffffffffffffffff
(in backtraces)
I know:
reading from 0
/ nullptr
is a not valid address.
reading from 0x58
, after the object there was deleted, will result in access violation, because I do not own the memory location.
So for 0xffffffffffffffff
, I know / assume:
object* obj;
would create pointer of type object* on the stack, value 0
/ nullptr
.object* obj = new object()
would create object on heap, store pointer to it in obj
, with a valid address like 000000000BD0ADA0
- needs to be deleted with delete obj
at some point. 0xffffffffffffffff
is all 1s in binary. Question: How do I end up with 0xffffffffffffffff
0xffffffffffffffff
?In my specific case, it's like this:
CustomItem* name_item = new CustomItem (i, elems[i]);
CustomItem (int sort_val, MyObject *obj) : _sort_val (sort_val), _mobj(obj) { }
model->setItem (i, 0, name_item);
#0 Qt5Gui public: void cdecl QStandardItemModel::setItem(int,int,class QStandardItem * ptr64) ptr64 +0xd (ip 0x7fee721bcfd fp 0x168470)
Comments: It's probably an uninitialized pointer.
I found that:
Object* obj; // is 0
However:
Object* obj1; // is 0
Object* obj2 = new Object(); // is 000000000BF6F100 (some valid address)
Object* obj3; // is 000000000BF6F100
Conclusion: Object* obj;
is not guaranteed to be 0.
Compiler or Debugger probably replaces uninitialized pointers to 0xffffffffffffffff
. Apparently only in some cases, because I could not reproduce it in a simple example. I'd like to have a link to some c++ specification, compiler specification or maybe visual studio debugger, that proved this.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.