comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos" <david.c.hoos.sr@ada95.com>
To: "Luke Guest" <lguest@bubball.com>
Cc: "comp.lang.ada@ada.eu.org" <comp.lang.ada@ada-france.org>
Subject: Re: Overloading procedures with Float and Long_Float types
Date: Mon, 8 Mar 2004 10:04:28 -0600
Date: 2004-03-08T10:04:28-06:00	[thread overview]
Message-ID: <mailman.76.1078761889.327.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: 404c7dbf.0@entanet


----- Original Message ----- 
From: "Luke Guest" <lguest@bubball.com>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada-france.org>
Sent: Monday, March 08, 2004 8:03 AM
Subject: Re: Overloading procedures with Float and Long_Float types


> > 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
> 
> It doesn't need them, this is OpenGL!
> 
> Translate calls an imported glTranslate[fd] procedure depending on the
> parameter types.
>
Ah, you're calling a function with no return type which modifies a
hidden matrix, in place -- not a very good software design, IMHO.

But, if you're binding to software with a poor design, I guess you
have no choice,
 
> > 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.
> 
> Would this allow the compiler to determine whichprocedure to call based
> purely on numbers?
>
No, it wouldn't -- it would just give a further measure of
compiler-independence -- a good thing.

Incidentally, in your example, you're not calling "purely with numbers."
you're calling with character representations of numbers which have, in Ada
the type Universal_Real.  You need to call with values of the type with
which you wish to select the overloaded procedure to be called.

To do this, my choice would be to use a qualified expression (RM 4.7),
rather than use a type conversion as others have suggested.

> Translate(1.0, 0.0, 0.0); -- Is this Short_Float or Long_Float?
>
Neitheer -- it's Universal_Real
 
> 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 16:04 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
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 [this message]
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