int *p = new int[7];
p = p + 7;
*p = 42;
int a[7];
a[7] = 42;
Programming languages suitable for writing low-level system
software must allow direct access to memory. This is achieved
with pointers, which store memory addresses, or a similar
mechanism. C and C++, currently the second and third
most popular
programming languages respectively (as of July 2007), give programmers
full access to the power of pointer arithmetic without any
checks on how that power is used. It is left up to the programmer
to ensure this is done correctly. Herein lies the problem:
programmers make mistakes.
Frequently.
Mudflap Improved with Referent Objects implements runtime checking of pointer operations for C and C++ programs in GCC 4. MIRO has the following main features:
The project report describes the project in detail. MIRO can be downloaded (74MB) as part of a complete GCC package including instructions on how to use it.