Re: C++ Bounds Checking
- From: "Wade Ward" <invalid@xxxxxxxxxxxx>
- Date: Fri, 29 Jun 2007 20:17:04 -0400
"dpb" <none@xxxxxxx> wrote in message news:f64185$m2o$1@xxxxxxxxxxx
Wade Ward wrote:
"dpb" <none@xxxxxxx> wrote in message news:f63ib8$vvn$1@xxxxxxxxxxx
I tried to search for "unitialized data" in my compiler's manual but got
no matches.
Look in the programmers' guide (or whatever they call it) section for
compiler switches/flags/options and peruse them.
/BOUNDS_CHECK
Check array subscripts only (/CHECK includes /BOUNDS_CHECK).
/CHECK more...
Causes code to be planted in order to enable the run-time checking of array
bounds, overflow etc., and also to enable the use of the source-level
debugging facilities (/CHECK implies /DEBUG).
/QUICK_BOUNDS more...
Outputs code to do a quick check on array bounds. Only checks total bound
size. This gives some protection against array-bounds being exceeded without
the run-time expense of /CHECK.
/UNDEF more...
Implies /CHECK and also causes code to be planted in order to do run-time
checking for any undefined variables or array elements.
These look like good candidates. Now I gotta figure out how to get them
operating in the IDE.
--
WW
Maybe the best way to deal with this is to make an array allocatable, so
that the same variable that defines its size can be used as the bound for
loops.
That's one way -- but, what if you're in the main routine and are reading
an unknown amount of data yet? Egg and chicken...
As noted, there are lots of ways to handle it. What's most appropriate is
dependent on the situation. Automatic arrays and subroutines are another.
Simply using an array slice w/ the same variable is quite appropriate and
adequate in many cases as well.
It sure is nice to know how to
write output to text files as opposed to doing the gymnastics of
redirecting output with a dos prompt.
Undoubtedly, altho redirection is useful, too... :)
--
.
- References:
- C++ Bounds Checking
- From: Gary Scott
- Re: C++ Bounds Checking
- From: Gary Scott
- Re: C++ Bounds Checking
- From: Wade Ward
- Re: C++ Bounds Checking
- From: dpb
- Re: C++ Bounds Checking
- From: dpb
- Re: C++ Bounds Checking
- From: Wade Ward
- Re: C++ Bounds Checking
- From: dpb
- C++ Bounds Checking
- Prev by Date: Re: fileid=get_lun()
- Next by Date: Re: Need Help: compiling old Fortran program
- Previous by thread: Re: C++ Bounds Checking
- Next by thread: Re: C++ Bounds Checking
- Index(es):
Relevant Pages
|