comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Why is Function Defined Twice?
Date: Sun, 14 May 2006 20:51:33 +0100
Date: 2006-05-14T20:51:33+01:00	[thread overview]
Message-ID: <m2u07s75bu.fsf@grendel.local> (raw)
In-Reply-To: 126erl3o7kb1p1a@corp.supernews.com

"Jason C. Wells" <jcw@highperformance.net> writes:

> I don't understand why the function ASUM is defined twice in the
> following example.  Which version gets called when I use ASUM?  How does
> Ada determine precedence on which gets called?  What is the big concept
> that I need to associate with this practice so I can go do more studying?

It depends on how you call them.

You might get more enlightenment from looking at the package spec? but
-- at a guess --

>    function ASUM (
>      N    : Natural;
>      X    : Vector_Type;
>      INCX : Natural
>    ) return Float_Type'Base is

processes the first N elements of X using (an increment?? every
INCX'th element??) and will be called when you say

  F := ASUM (5, V, 2);

>    function ASUM (X : Vector_Type) return Float_Type'Base is

processes every element of X with an increment of 1 and will be called
when you say

  F := ASUM (V);





      parent reply	other threads:[~2006-05-14 19:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-14 17:55 Why is Function Defined Twice? Jason C. Wells
2006-05-14 19:25 ` Jeffrey R. Carter
2006-05-14 19:51 ` Simon Wright [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox