Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if pointers overlap?

Tags:

c

pointers

I've read a a tip here: http://www.cprogramming.com/tips/showTip.php?tip=183

saying:

Also monitor that the pointers are not overlapping if not pointing to same memory location range.

How can one monitor such thing? Comparing every pointer to each other is obviously silly.

like image 567
imzs Avatar asked Nov 05 '22 14:11

imzs


1 Answers

You can't, and you shouldn't constantly. This is probably just a debugging hint for some problem the author once encountered, and maybe useful in embedded systems.

In general, valgrind helps you more when you have pointer issues than any manual comparison.

like image 58
thiton Avatar answered Nov 15 '22 06:11

thiton