Re: range checking
- From: "Rob Thorpe" <robert.thorpe@xxxxxxxxxxxx>
- Date: 12 Aug 2006 07:35:17 -0700
Christian Christmann wrote:
Hi,
in GDB you can set the option "check range". However,
this option just works with some languages that
have to be defined in GDB by "set language ...".
When choosing C, C++ or Java as langauge, the
range-checking option is not available, but it works
with e.g. Pascal. What exactly is meant by the
term "range checking"? Does Pascal allow to check if
for example arrays are accessed out of their range, like
int[2] = {1, 2};
int{2] = 5; // int[2] out of range
Yes.
Generally this feature isn't normally available in C even as a compiler
switch. It was once available as a patch to GCC, but irritatingly was
never installed. The TCC does it though.
In C it is difficult to do in general, because the language supports
arbitrary operations on pointers. It can only be done by making
assumptions about pointers that come from other libraries.
In C implementations other than TCC you can still do something though,
you can range check check heap allocated arrays. To do this you need a
memory debugger library such as "Electric Fence".
.
- References:
- range checking
- From: Christian Christmann
- range checking
- Prev by Date: Re: graphics programming newbie - grid representation technique
- Next by Date: higher level 3d programming
- Previous by thread: range checking
- Next by thread: mapping numbers to 'random' numbers and back
- Index(es):
Relevant Pages
|