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.4 required=5.0 tests=BAYES_00,SUBJ_ALL_CAPS autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,51359402da60c472 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-18 04:14:01 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!proxad.net!newsfeed.stueberl.de!newsr1.ipcore.viaginterkom.de!btnet-peer1!btnet-peer0!btnet-feed5!btnet!news.btopenworld.com!not-for-mail From: john@nospam.demon.co.uk (John McCabe) Newsgroups: comp.lang.ada Subject: Re: DYNAMIC ADA TASK CREATION? Date: Wed, 18 Jun 2003 11:13:37 +0000 (UTC) Organization: BT Openworld Message-ID: <3ef04842.436197@news.btclick.com> References: <3EF0026E.2050309@attbi.com> NNTP-Posting-Host: host217-37-177-69.in-addr.btopenworld.com X-Trace: hercules.btinternet.com 1055934817 4596 217.37.177.69 (18 Jun 2003 11:13:37 GMT) X-Complaints-To: news-complaints@lists.btinternet.com NNTP-Posting-Date: Wed, 18 Jun 2003 11:13:37 +0000 (UTC) X-Newsreader: Forte Free Agent 1.21/32.243 Xref: archiver1.google.com comp.lang.ada:39384 Date: 2003-06-18T11:13:37+00:00 List-Id: On Wed, 18 Jun 2003 09:20:01 +0000 (UTC), Georg Bauhaus wrote: >: Correct. But if you don't want to get stuck there, do this instead: >: >: -- task type t as above >: type ta is access t; >: >: type ts is array (positive range <>) of ta := new t; > ^^^^^^^^ >I think I got the idea and made me program to see the tasks working >outside the declare block. A good hint! >But is new t on the line above some new default initialisation >construct, or meant to abbreviate something? (The compiler complains.) : : declare : the_ts : ts (1 .. n); : begin : -- do something with the tasks : -- NB, CAN pass this once all the tasks have been created. : end; : I'm not surprised, you're trying to initialise a type!! Simon did say he hadn't compiled this though! You need to remove the ' := new t' at the end, then actually create the tasks something like: -- task type t as above type ta is access t; type ts is array (positive range <>) of ta; declare the_ts : ts (1 .. n); begin for Index in 1 .. n loop the_ts(n) := new t; end loop; -- do something with the tasks -- NB, CAN pass this once all the tasks have been created. end; Just a vague thought....does.. declare the_ts : ts (1 .. n) = (others => new t); begin .... compile? Best Regards John McCabe To reply by email replace 'nospam' with 'assen'