|
Boost Users : |
Subject: Re: [Boost-users] Pointer "boundary checker" class or tools?
From: Jens Auer (jensa_at_[hidden])
Date: 2011-07-26 07:31:06
________________________________
From: boost-users-bounces_at_[hidden] [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Hoe-Phuan Ng
Sent: Saturday, July 23, 2011 7:56 PM
To: boost-users_at_[hidden]
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
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net