Login | Register
My pages Projects Community openCollabNet

Discussions > cvs > CVS update: /charles/src/ai302/

charles
Discussion topic

Back to topic list

CVS update: /charles/src/ai302/

Reply

Author matthewjheaney
Full name Matthew Heaney
Date 2005-04-02 11:21:47 PST
Message User: matthewjheaney
Date: 05/04/02 11:21:47

Modified:
 /charles/src/ai302/
  a-convec.adb

Log:
 use liberal rule for index-based delete: allow index param to have the
 value last_index(v) + 1, irrespective of value of count param.

File Changes:

Directory: /charles/src/ai302/
==============================

File [changed]: a-convec.adb
Url: http://charles.tigri​s.org/source/browse/​charles/src/ai302/a-​convec.adb?r1=1.28​&r2=1.29
Delta lines: +17 -24
---------------------
--- a-convec.adb 2 Apr 2005 04:45:32 -0000 1.28
+++ a-convec.adb 2 Apr 2005 19:21:47 -0000 1.29
@@ -1210,32 +1210,25 @@
    procedure Delete (Container : in out Vector;
                      Index : in Extended_Index; --TODO: see note below
                      Count : in Count_Type := 1) is
+ begin
 
- --NOTE 2005/03/25:
- -- The AARM is telling me that the index check happens prior to the
- -- check for Count=0. Needless to say I think this is ridiculus, since
- -- such behavior is contrary to precedent long established by the
- -- semantics of null array slices.
- --ENDNOTE.
-
- --NOTE 2005/03/25:
- -- The Index parameter has subtype Extended_Index, but this
- -- doesn't really make sense, since the "extended" values
- -- IT'First - 1 and IT'Last + 1 are both guaranteed to fail the
- -- index check that happens below. Index_Type would appear to be
- -- a better choice.
- --
- -- The use of subtype Extended_Index is probably vestigial, from
- -- the time when the API specified that the check for Count=0
- -- happened prior to any index check.
- --ENDNOTE.
-
- subtype I_Subtype is Index_Type'Base range
- Index_Type'First .. Container.Last;
+ if Index < Index_Type'First then
+ raise Constraint_Error;
+ end if;
 
- I : constant I_Subtype := Index; -- raise CE when check fails
+ -- NOTE: 2005/04/02 (MJH):
+ -- I have liberalized the rules wrt what's specified in the
+ -- current version of the Ada 2005 RM, pending resolution
+ -- by the ARG of allowed values for the Index parameter.
+ -- ENDNOTE.
+ --
+ if Index > Container.Last then
+ if Index > Container.Last + 1 then
+ raise Constraint_Error;
+ end if;
 
- begin
+ return;
+ end if;
 
       if Count = 0 then
          return;
@@ -1245,7 +1238,7 @@
          raise Program_Error;
       end if;
 
- Do_Delete (Container, I, Count);
+ Do_Delete (Container, Index, Count);
 
    end Delete;
 




--------------------​--------------------​--------------------​---------
To unsubscribe, e-mail: cvs-unsubscribe@char​les.tigris.org
For additional commands, e-mail: cvs-help at charles dot tigris dot org

« Previous message in topic | 1 of 1 | Next message in topic »

Messages

Show all messages in topic

CVS update: /charles/src/ai302/ matthewjheaney Matthew Heaney 2005-04-02 11:21:47 PST
Messages per page: