comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos" <david.c.hoos.sr@ada95.com>
Subject: Re: Overloading procedures with Float and Long_Float types
Date: Mon, 8 Mar 2004 06:46:45 -0600
Date: 2004-03-08T06:46:45-06:00	[thread overview]
Message-ID: <QTZ2c.58201$0l1.48212@bignews3.bellsouth.net> (raw)
In-Reply-To: pan.2004.03.08.00.17.32.527941@n_o_p_o_r_k_a_n_d_h_a_m.abyss2.demon.co.uk

Your procedure specifications raise an interesting question, viz.:

What is the result of this procedure?  There are no out or "in out"
parameters.  I would expect something like this to either be a
function returning some kind of composite type, or to have one or
more out parameters.  Now if the "result of the procedure is some
kind of action (e.g., on the display), then these could be
legitimate procedure specifications, but in that case, it would be
better if they were given a name that describes the action taken,

As a matter of good practice, I would not use the type "Float",
but would explicitly make the two subtypes Short_Float and
Long_Float.

Some years ago, one of the Ada 83 compilers decided on the occasion
of a version upgrade to change Float from Long_Float to Short_Float
or vice-versa, I don't remember. I just remember the massive chaos
caused by the fact that many programmers (it was a large project)
had not used the project-defined types (Short_Real and Long_Real),
using Float instead.  Thins which worked with the previous
compiler version suddenly worked no more.


"Luke A. Guest" <laguest@n_o_p_o_r_k_a_n_d_h_a_m.abyss2.demon.co.uk> wrote
in message
news:pan.2004.03.08.00.17.32.527941@n_o_p_o_r_k_a_n_d_h_a_m.abyss2.demon.co.uk...
> Hi,
>
> Is there a safe way to do this? I'm playing with the adaopengl bindings
> and have created the following:
>
> subtype GLfloat is Float;
> subtype GLdouble is Standard.Long_Float;
>
> procedure Vertex(X, Y, Z : in GLdouble);
> procedure Vertex(X, Y, Z : in GLfloat);
>
> But the compiler (GNAT - Gentoo's 5.02w version) throws up ambiguity
> problems.
>
> Is there a nice way to have these two procedures co-exist without having
to
> rename them? I have currently renamed them, but this does defeat the whole
> purpose of this experiment.
>
> Thanks,
> Luke.
>
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada-france.org
> http://www.ada-france.org/mailman/listinfo/comp.lang.ada
>
>




  parent reply	other threads:[~2004-03-08 12:46 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-08  0:17 Overloading procedures with Float and Long_Float types Luke A. Guest
2004-03-08  3:49 ` James Rogers
2004-03-08  8:16   ` Luke A. Guest
2004-03-08  8:20     ` Preben Randhol
2004-03-08  9:06       ` Luke A. Guest
2004-03-08 10:10         ` Dmitry A. Kazakov
2004-03-08 14:05           ` Luke Guest
2004-03-08 14:07             ` Preben Randhol
2004-03-08 15:10               ` Luke Guest
2004-03-08 16:20                 ` Preben Randhol
2004-03-08 16:28                   ` Luke Guest
2004-03-08 17:58                     ` Preben Randhol
2004-03-09  8:55                       ` Dmitry A. Kazakov
2004-03-08 16:50                   ` Hyman Rosen
2004-03-08 16:55                     ` Luke Guest
2004-03-08 17:32                       ` Hyman Rosen
2004-03-08 14:37             ` Dmitry A. Kazakov
2004-03-08 15:18               ` Luke Guest
2004-03-08 19:52                 ` Gautier Write-only
2004-03-08 20:34                   ` Luke A. Guest
2004-03-09  8:40                 ` Dmitry A. Kazakov
2004-03-08 12:46 ` David C. Hoos [this message]
2004-03-08 14:03   ` Luke Guest
2004-03-08 14:54     ` Georg Bauhaus
2004-03-08 15:19       ` Luke Guest
2004-03-08 16:04     ` David C. Hoos
2004-03-08 16:17       ` Luke Guest
2004-03-09  9:24         ` Dmitry A. Kazakov
2004-03-08 19:58       ` Gautier Write-only
     [not found]     ` <1faf01c40527$0a364a10$b101a8c0@sy.com>
2004-03-08 16:21       ` Preben Randhol
replies disabled

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