Re: C++ Bounds Checking



Gordon Sande wrote:

On 2007-06-28 23:54:54 -0300, Gary Scott <garylscott@xxxxxxxxxxxxx> said:

Beliavsky wrote:

On Jun 28, 8:43 pm, Gary Scott <garylsc...@xxxxxxxxxxxxx> wrote:

I probably don't have the syntax correct, but I read recently that you
can force bounds checking on an array by expressing an access something
like:

array.at[i]

whereas:

array[i]

would not cause bounds checking



I wonder if you are thinking of the vector container in the C++
standard library, which can be substituted for the array of C/C++ in
some cases.


Would something like that be useful in Fortran? Seems sort of kludgy
and partially redundant to me.



Good compilers have done checked for some time, and assumed shape
arrays "know their own size", so one can determine the dimensions of
array arguments of procedures. The C++ vector, unlike the C/C++ array,
has a similar feature.

The stated reason for the difference in the article I read was so that programmers could directly control in code whether automatic checking occurred or not.


Excuse my cynicism but it sure sounds like some overly macho hacker wants
his debugging run to completion in 29 seconds instead of 35 seconds and is
willing to waste 3 days effort to achieve that.

That was my impression of the feature, but I'm not language-design knowledgeable enough to make those sorts of public statements with confidence.


And it will turn out that
the out of bound subscript occurs somewhere that is not being checked
so another 6 days will be taken to track that down. And he can then brag
about how hard it was to find the bug and squash it.

If the problem occurred where you thought it was it would not be a problem.







--

Gary Scott
mailto:garylscott@sbcglobal dot net

Fortran Library: http://www.fortranlib.com

Support the Original G95 Project: http://www.g95.org
-OR-
Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html

If you want to do the impossible, don't hire an expert because he knows it can't be done.

-- Henry Ford
.



Relevant Pages

  • Re: ARRAY EQUATION VS FORALL
    ... my "style guide" requires arrays to have an explicit naming convention identifying the item as an array. ... Support the Original G95 Project: http://www.g95.org ... Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html ...
    (comp.lang.fortran)
  • Re: Inform Dungeon -- Need help translating
    ... Array outw->8; ... [Encrypt inw outw ichara i j uinws ukeyws usum; ... Support the Original G95 Project: http://www.g95.org ... Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html ...
    (comp.lang.fortran)
  • Re: C++ Bounds Checking
    ... can force bounds checking on an array by expressing an access something ... Support the Original G95 Project: http://www.g95.org ... Support the GNU GFortran Project: http://gcc.gnu.org/fortran/index.html ...
    (comp.lang.fortran)
  • Re: C++ Bounds Checking
    ... can force bounds checking on an array by expressing an access something ... has a similar feature. ...
    (comp.lang.fortran)
  • Re: C++ Bounds Checking
    ... can force bounds checking on an array by expressing an access something ... has a similar feature. ...
    (comp.lang.fortran)