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,89d280850f5d8df X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-21 11:00:48 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!canoe.uoregon.edu!arclight.uoregon.edu!newsfeed.mathworks.com!wn3feed!worldnet.att.net!204.127.198.204!attbi_feed4!attbi_feed3!attbi.com!rwcrnsc53.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Passing Unconstrained Arrays from FORTRAN to an Ada95 subunit References: <5489a352.0207210544.3d50d423@posting.google.com> X-Newsreader: Tom's custom newsreader Message-ID: NNTP-Posting-Host: 12.234.12.135 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc53 1027274328 12.234.12.135 (Sun, 21 Jul 2002 17:58:48 GMT) NNTP-Posting-Date: Sun, 21 Jul 2002 17:58:48 GMT Organization: AT&T Broadband Date: Sun, 21 Jul 2002 18:00:47 GMT Xref: archiver1.google.com comp.lang.ada:27285 Date: 2002-07-21T18:00:47+00:00 List-Id: > > What happens if you pass a constrained array, ie, > > type int_array_type is array(integer range 1.. 10) of integer; > Yes, this works, but the routine with the unconstrained array is called > by many other routines which pass it varying sizes of arrays. One technique used in interfacing to C is to declare type int_array_type is array(positive) of integer; That is, declare the array type large enough for any actual instance and then make sure in the Ada routine that you don't index beyond the actual data. It used to be common practice in Fortran to pass the length of the array as a separate parameter, eg procedure something(a,n) integer n,a(n) which you could write in Ada as procedure something(a : in out int_array_type; n : in positive); Does modern Fortran pass the length implicitly? Apparently your Ada compiler doesn't think so.