Pointer "boundary checker" class or tools?
Hello: I a new to C++. Have not use it yet. For a long time I was wondering if there is a way to automatically check if pointer has creep out of its "known area of access" in memory. Obviously such tool to check pointer would be really slow or too slow for release codes since we want to check pointer location at each pointer access, read or write. Is there such a tool or class to do Pointer "boundary checker" during debug? Thanks. HP
On Sat, Jul 23, 2011 at 10:56 AM, Hoe-Phuan Ng
Hello:
I a new to C++. Have not use it yet. For a long time I was wondering if there is a way to automatically check if pointer has creep out of its "known area of access" in memory. Obviously such tool to check pointer would be really slow or too slow for release codes since we want to check pointer location at each pointer access, read or write.
Is there such a tool or class to do Pointer "boundary checker" during debug?
Thanks. HP
_______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
The best tool I know of to do this is to Valgrind. I think it only runs on Unix-like platforms. Brian
Hello:
I a new to C++. Have not use it yet. For a long time I was wondering if there is a way to automatically check if pointer has creep out of its "known area of access" in memory. Obviously such tool to check pointer would be really slow or too slow for release codes since we want to check pointer location at each
On Sat, Jul 23, 2011 at 10:56 AM, Hoe-Phuan Ng
wrote: pointer access, read or write.
Is there such a tool or class to do Pointer "boundary checker" during debug?
On Windows, there is pageheap, which can be activated as a part of App Verifier. App Verifier has lots of useful runtime checking, beyond just pageheap. You generally have to run the code in the debugger (I use WinDbg), and it'll break in whenever something it's watching for happens. http://msdn.microsoft.com/en-us/library/ms220948%28v=vs.90%29.aspx -Steve
________________________________ From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Hoe-Phuan Ng Sent: Saturday, July 23, 2011 7:56 PM To: boost-users@lists.boost.org Subject: [Boost-users] Pointer "boundary checker" class or tools? I a new to C++. Have not use it yet. For a long time I was wondering if there is a way to automatically check if pointer has creep out of its "known area of access" in memory. Obviously such tool to check pointer would be really slow or too slow for release codes since we want to check pointer location at each pointer access, read or write. Hi, I would discourage anybody to C++ from using plain arrays if there is not a really good reason to do so. The stl provides std::vector for dynamic arrays which has a checked access method. Additionally, implementations may provide additional checks in debug code, e.g. Visual C++ provides checked iterators and other stuff. For fixed-sized arrays, std::array mimics the std::vector interface. Best regards, Jens
participants (4)
-
Brian Budge
-
Hoe-Phuan Ng
-
Jens Auer
-
Steve Dispensa