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,2cc84c0fee9046c0 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!newsfeed.utanet.at!newsfeed.inode.at!news.hispeed.ch!linux2.krischik.com!news From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: Various Language Architecture Questions Date: Sun, 25 Sep 2005 10:17:34 +0200 Organization: Cablecom Newsserver Message-ID: <2306302.G5vPNUK31l@linux1.krischik.com> References: <1127615832.540718.246970@g43g2000cwa.googlegroups.com> NNTP-Posting-Host: 84-73-3-68.dclient.hispeed.ch Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7Bit X-Trace: news.hispeed.ch 1127637915 20286 84.73.3.68 (25 Sep 2005 08:45:15 GMT) X-Complaints-To: news@hispeed.ch NNTP-Posting-Date: Sun, 25 Sep 2005 08:45:15 +0000 (UTC) User-Agent: KNode/0.9.2 Xref: g2news1.google.com comp.lang.ada:5127 Date: 2005-09-25T10:17:34+02:00 List-Id: frankgerlach@gmail.com wrote: > Hello, > I am contemplating to create a new language, which is supposed to be as > fast as C++, but as safe as Java. Ada is not as save as Java - it's a lot saver. As for speed: thats tricky. If you program as defensive in C++ as Ada is from nature Ada will probably outperform C++. But most C++ programs are not that defensive. You might want to read: http://en.wikibooks.org/wiki/Ada_Programming/Error_handling#Design_by_Contract > Maybe Ada is already fulfilling these requirements, so I have a few > questions: The answer to all questions is indeed "Yes". > Is is possible to safely allocate objects on the stack and then pass a > pointer to these objects to a procedure ? > (The stack is very fast, but I cannot tolerate invalid references from > the heap or from "older" stack regions) http://en.wikibooks.org/wiki/Ada_Programming/Object_Orientation#The_class-wide_type > Are the common Ada runtimes performing range checks on Arrays, > including "casted" pointers ? > (Typecasting is necessary for high-performance access, but I want to be > safely in bounds of the array all the time) Ada supports more then just "typecast" - it has more different "cast" operators then modern C++ has: http://en.wikibooks.org/wiki/Ada_Programming/Subtypes#Converting_data > Also, it should be forbidden (by compiler or runtime) to cast a type > that contains a pointer to a different type. Does Ada support this ? (I > must secure pointers in order to have only valid pointers in the > system. Invalid pointers introduce random errors or security problems > for a sandbox execution model) Ada's "pointer" management is a lot more complex. Read: http://en.wikibooks.org/wiki/Ada_Programming/Memory Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com