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=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,8d5151b6052512f7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2004-03-08 08:14:56 PST Path: archiver1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!crtntx1-snh1.gtei.net!news.gtei.net!newsfeed1.easynews.com!newsfeed3.easynews.com!easynews.com!easynews!newsfeed.news2me.com!newsfeed.icl.net!proxad.net!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: "David C. Hoos" Newsgroups: comp.lang.ada Subject: Re: Overloading procedures with Float and Long_Float types Date: Mon, 8 Mar 2004 10:04:28 -0600 Organization: Cuivre, Argent, Or Message-ID: References: <404c7dbf.0@entanet> NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: melchior.cuivre.fr.eu.org 1078761890 13997 212.85.156.195 (8 Mar 2004 16:04:50 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Mon, 8 Mar 2004 16:04:50 +0000 (UTC) Cc: "comp.lang.ada@ada.eu.org" To: "Luke Guest" Return-Path: X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1158 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Virus-Scanned: by amavisd-new-20030616-p7 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Gateway to the comp.lang.ada Usenet newsgroup" List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:6149 Date: 2004-03-08T10:04:28-06:00 ----- Original Message ----- From: "Luke Guest" Newsgroups: comp.lang.ada To: 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 >