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-Thread: 103376,9ce095aba33fe8d0 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Negative float problem Date: 01 Nov 2005 19:13:36 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1130351574.313991.229420@g14g2000cwa.googlegroups.com> <10mspnley7gzu$.1swtj67sv0ldr$.dlg@40tude.net> <43677dec$1_1@glkas0286.greenlnk.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1130890416 1132 192.74.137.71 (2 Nov 2005 00:13:36 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 2 Nov 2005 00:13:36 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:6098 Date: 2005-11-01T19:13:36-05:00 List-Id: "Martin Dowie" writes: > Robert A Duff wrote: > > I think Dmitry's point is that overload resolution in Ada is both > > bottom-up and top-down. It's simpler in C++ -- just bottom-up. > > > > type Color is (Red, Blue); > > type Traffic_Light is (Green, Amber, Red); > > procedure P(Param: Color); > > > > P(Red); > > > > This is legal in Ada. The compiler knows which Red is meant > > based on the expected type for Param. Similar things are > > illegal in C++ (I think -- am I right?). > > Yup, you can't have overloaded enumeration values - I guess because they are > really just 'int', so which one would you mean? Sorry. My post was confusing. In Ada, enum lits are parameterless functions. So the corresponding thing in C++ would be parameterless functions. So pretend my example was something like: function Red return Color; function Blue return Color; function Green return Traffic_Light; function Amber return Traffic_Light; function Red return Traffic_Light; procedure P(Param: Color); P(Red); That sort of thing works fine in Ada, but C++ doesn't like it. I wasn't talking about the difference between enums in C++ versus Ada. I was talking about the difference in overload resolution rules. Namely that the result type of a function call is used to resolve in Ada, but not in C++. (And by the way Ada has this weird idea that enum lits are functions.) - Bob