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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,703c4f68db81387d X-Google-Thread: 109fba,703c4f68db81387d X-Google-Thread: 115aec,703c4f68db81387d X-Google-Thread: f43e6,703c4f68db81387d X-Google-Attributes: gid103376,gid109fba,gid115aec,gidf43e6,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news1.google.com!news.maxwell.syr.edu!news.glorb.com!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!feeder.xsnews.nl!feeder.news-service.com!post.news-service.com!news1.surfino.com!not-for-mail Message-Id: <1754779.FoL2iyrB1S@linux1.krischik.com> From: Martin Krischik Subject: Re: [OT] Re: Teaching new tricks to an old dog (C++ -->Ada) Newsgroups: comp.lang.ada,comp.lang.c++,comp.realtime,comp.software-eng Reply-To: martin@krischik.com Date: Sat, 12 Mar 2005 12:56:30 +0100 References: <4229bad9$0$1019$afc38c87@news.optusnet.com.au> <1110032222.447846.167060@g14g2000cwa.googlegroups.com> <871xau9nlh.fsf@insalien.org> <3SjWd.103128$Vf.3969241@news000.worldonline.dk> <87r7iu85lf.fsf@insalien.org> <1110052142.832650@athnrd02> <42309456$1@news.broadpark.no> <1110569032.207770@athnrd02> Organization: None User-Agent: KNode/0.8.0 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Complaints-To: abuse@surfino.com NNTP-Posting-Host: 83.169.175.19 (83.169.175.19) NNTP-Posting-Date: Sat, 12 Mar 2005 13:00:16 +0100 X-Trace: ae5114232d9d0f60c0ab609762 Xref: g2news1.google.com comp.lang.ada:9219 comp.lang.c++:45285 comp.realtime:1352 comp.software-eng:4916 Date: 2005-03-12T12:56:30+01:00 List-Id: Ioannis Vranos wrote: > Dr. Adrian Wrigley wrote: > >>>Ada features I would love to have in C++: >>>* "new types" and sub-ranges > I do not know what you mean exactly by that, however one can define his > own types rather than having everything as built-in. explicit typedef int My_Integer; As you know "explicit" deactivates implicid type convertions. Sadly it can only by applied to type convertion contructors and not to types itself. See: http://en.wikibooks.org/wiki/Programming:Ada:Subtypes#Type_declaration The other would be explicit typdef int <1, 31> Day_Of_Month; See: http://en.wikibooks.org/wiki/Programming:Ada:Types:range > C++ provides general purpose facilities with which one can build his own > special purpose libraries, rather than providing special purpose > facilities as built in. Shure you can create a template for the problem above - but without the "explicit typdef" you always have the problem of template Range class {....} typedef Range <1, 12> Month_Of_Year; typedef Range <1, 12> US_Hour; I have 10+ years experience of C/C++ - I already know the little tricks you could do to circumvent the problem above. It would be nicer without tricks. > From my (perhaps limited) experience of .NET where run-time generics > are also available to C++ (with the upcoming C++/CLI, .NET 2 and VC++ > 2005 - currently Beta), run-time generics are more limited than > compile-time templates. Also since they are run-time they are less > efficient. I think they are more free: template Bounded_Array class {...}; void F (int size) { auto Bounded_Array Data; } And yes: that works in Ada. > May I assume that packages are a form of precompiled dynamic-link > libraries, like dlls in Windows? No - usualy they result in .obj files. Ada packages consist of a specification file and a body file which result into object file and some form of precompiled header file. The Ada language more or less demands some form of precompiled header files (very simply speaking). Some Ada compilers use a library database to store the objects and the compiled specifications. See: http://en.wikibooks.org/wiki/Programming:Ada:Packages >> Portability without resorting to preprocessor directives >> and conditional compilation > These are used essentially for system-oriented code. No, almost all header files need: #if defined (X_INCLUDED) #define X_INCLUDED) #endif Which brings us back to the packages ;-) . Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com