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=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,194f7a105da14a4c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-08-19 08:06:40 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.arcor-online.net!fu-berlin.de!uni-berlin.de!82-43-33-75.cable.ubr01.croy.blueyonder.co.UK!not-for-mail From: "Nick Roberts" Newsgroups: comp.lang.ada Subject: Re: What is happening Here?Totally clueless Date: Tue, 19 Aug 2003 16:06:37 +0100 Message-ID: References: NNTP-Posting-Host: 82-43-33-75.cable.ubr01.croy.blueyonder.co.uk (82.43.33.75) X-Trace: news.uni-berlin.de 1061305598 3156680 82.43.33.75 (16 [25716]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4807.1700 Xref: archiver1.google.com comp.lang.ada:41720 Date: 2003-08-19T16:06:37+01:00 List-Id: "prashna" wrote in message news:d40d7104.0308190522.4b631227@posting.google.com... > array1 := (others => 0); > array1(1..2) := array_local'(others => (2)); > ^^^^ can anybody what exactly is this?why they > are not assigning directly to 2 without doing this(Typecast????) This is a qualification that it being used, as a special syntactic construction, as an array aggregate (of a specific subtype). > When I execute a constraint error is being raised.Can any body explain > what is going on here. The specific subtype in this case -- array_local -- has length 10, whereas the destination array -- array1 -- as length 2. When assigning an array value to an array variable (of the same type but different subtypes), the value and variable must be of the same length. In fact, they do not have to have the same bounds. If they are the same length but of different bounds, the value 'slides' into the variable (the variable's bounds do not change). An anonymous array aggregate with indefinite length (because it contains 'others') automatically assumes the length of the destination. Thus the following are legal declarations and statements: declare array2: array_unconstrained(11..20); subtype array_small is array_unconstrained(1..5); begin array1 := array_local'(others => 0); -- slides 1..10 -> 11.20 array1(1..2) := (others => 2); -- assumes length 2 array2 := array1; -- slides 1..10 -> 11.20 array2(12..16) := array_small'(others => 3); -- slides 1..5 -> 12..16 end; > Thanks in advance, Hope This Helps. -- Nick Roberts Jabber: debater@charente.de [ICQ: 159718630]