From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,de6163af173c0de3,start X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Received: by 10.66.80.166 with SMTP id s6mr1635696pax.30.1344888352182; Mon, 13 Aug 2012 13:05:52 -0700 (PDT) Path: c10ni111828pbw.0!nntp.google.com!news1.google.com!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail From: awdorrin Newsgroups: comp.lang.ada Subject: Question Exception with Ada.Containers.Generic_Constrained_Array_Sort Date: Mon, 13 Aug 2012 13:05:51 -0700 (PDT) Organization: http://groups.google.com Message-ID: NNTP-Posting-Host: 192.31.106.35 Mime-Version: 1.0 X-Trace: posting.google.com 1344888352 6868 127.0.0.1 (13 Aug 2012 20:05:52 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 13 Aug 2012 20:05:52 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=192.31.106.35; posting-account=YkFdLgoAAADpWnfCBA6ZXMWTz2zHNd0j User-Agent: G2/1.0 Content-Type: text/plain; charset=ISO-8859-1 Date: 2012-08-13T13:05:51-07:00 List-Id: I had this code working, but today I started getting 'length check failed' exceptions. I'm trying to implement a Generic_Constrained_Array_Sort to sort a slice of a constrained array. Now I'm not sure if it is possible to pass a slice of the array into the constrained generic sort procedure. Its possible I broke something somewhere else in the code that was related to this, but I haven't been able to track it down yet. Here is what I'm trying to do: procedure DXSort is new Ada.Containers.Generic_Constrained_Array_Sort( Index_Type => Device_Index_Type, Element_Type => Device_Object_Type, Array_Type => Device_Array_Type, "<" => DevName_Less_Than); With the following declarations: type Node_Rec_Type is private; type Node_Ptr_Type is access Node_Rec_Type; subtype Device_Object_Type is Node_Ptr_Type; subtype Device_Index_Type is Int32 range 1 .. 128; type Device_Array_Type is array(Device_Index_Type) of Device_Object_Type; The comparison function is: function DevName_Less_Than( L,R : Device_Object_Type) return Boolean is begin if GetDeviceName(L) < GetDeviceName(R) then return TRUE; else return FALSE; end if; end DevName_Less_Than; I make the call to the DXSort procedure with the following call: DXSort( DevList.DeviceList(1..DevList.Num_Devices) ); Num_Devices is always less than 128. DevList is a record defined as: type DevListType is record Num_Devices : Int32; DeviceList : Device_Array_Type; end record; I thought that the issue might have to do with having 'Num_Devices' of type 'Int32' in the record, but defining the 'Device_Index_Type' subtype, but experimenting with changing the type still left me with 'length check failed'. Any suggestions would be greatly appreciated! :) -Al