码迷,mamicode.com
首页 > 其他好文 > 详细

悬垂指针和野指针的区别

时间:2020-07-12 01:03:42      阅读:90      评论:0      收藏:0      [点我收藏+]

标签:use   less   correct   rect   oca   tween   having   ISE   val   

Difference between Dangling Pointer and Wild Pointer?

A dangling pointer is a pointer that used to point to a valid address but now no longer does. This is usually due to that memory location being freed up and no longer available. There is nothing wrong with having a dangling pointer unless you try to access the memory location pointed at by that pointer. It is always best practise not to have or leave dangling pointers.

A wild pointer is a pointer that has not been correctly initialised and therefore points to some random piece of memory. It is a serious error to have wild pointers.

悬垂指针之前指向的是有效的地址,但是现在不是这样了,通常是那个内存地址被释放掉了.

而野指针是没有被正确初始化,它指向了内存中随机的位置.

悬垂指针和野指针的区别

标签:use   less   correct   rect   oca   tween   having   ISE   val   

原文地址:https://www.cnblogs.com/Stephen-Qin/p/13286066.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!