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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,571930b4ff0bc1ee X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-03-30 11:01:26 PST Path: supernews.google.com!sn-xit-03!supernews.com!news-feed.riddles.org.uk!newsfeed.direct.ca!look.ca!hammer.uoregon.edu!skates!not-for-mail From: Stephen Leake Newsgroups: comp.lang.ada Subject: Re: Compile time executed functions Date: 30 Mar 2001 13:54:38 -0500 Organization: NASA Goddard Space Flight Center Message-ID: References: <3AC03CCE.70E3C2D5@mida.se> <3AC18DD1.EF25CE42@mida.se> <5mzw6.415$1H6.72722473@newssvr16.news.prodigy.com> <3AC2EB17.33AAEC0A@mida.se> <3AC46252.B7E54EA6@free.fr> <3AC4B7F9.7C73455A@free.fr> NNTP-Posting-Host: anarres.gsfc.nasa.gov MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: skates.gsfc.nasa.gov 985979349 2937 128.183.220.71 (30 Mar 2001 19:09:09 GMT) X-Complaints-To: dscoggin@cne-odin.gsfc.nasa.gov NNTP-Posting-Date: 30 Mar 2001 19:09:09 GMT User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/20.6 Xref: supernews.google.com comp.lang.ada:6267 Date: 2001-03-30T19:09:09+00:00 List-Id: Jean-Marc Bourguet writes: > > : First feature, things like > > : enum { foo = x+y*z; } > > : are valid as long as x, y and z value are known at compile time and have > > : to be evaluated at compile time. > > > > Isn't this usually resolvable as a constant by most Ada compilers? At least > > the ones I know will usually do so. > > It is quite difficult to come with the equivalent in Ada. One is > foo : constant = x+y*z; > is indeed resolvable by most Ada compiler. Actually, since C and C++ define an enum to be just a named int, this is the _exact_ equivalent in Ada. Perhaps you meant to say that package A_Package is X : constant := 2; Y : constant := 3; Z : constant := 4; type Bar is (Foo); for Bar use (Foo => x + y * z); end A_Package; is not legal Ada. However, GNAT 3.14a disagrees with you. -- -- Stephe