-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On Feb 1, 2005, at 1:59 PM, Frank Heckenbach wrote:
issues. Since Ada's main goal is to be strongly typed and safe at runtime, I can't really imagine they added things such as unchecked type-casts, "absolute" variables, assembler statements and machine code inlines, low-level memory access (FillChar, Move), misusing constants as variables, confusion between pointers and arrays and sometimes single elements and arrays etc., to name just some of the most problematic ones.
Correct, those are not features of Ada. Ada *does* have features like AND THEN and OR ELSE (like GPC's AND_THEN, OR_ELSE), and a number of really cool features that are not even part of GPC to my knowledge. Then again, GPC has some things (like SETs) which Ada does not...
Ada has the notion of a "range", which is a sequence of values with a starting point and an ending point. In other words, a range could be 1..5, 'a'..'z', etc., but it cannot contain disjoint values as can one of Pascal's SETs -- ['A', '5'..'7'] cannot be reproduced easily in Ada.
However, you can do some interesting things with the ranges:
for i in 1..5 loop -- standard Ada for loop header
for i in Integer'Range -- another way to look at it, hmm...
Ada *does* have type casts, but they are neither 'unchecked' nor arbitrary. Additionally, you can't even directly perform mathematical operations between integers and reals without casting them. Ada is very picky, but it certainly does make it much more difficult to accidentally leave many kinds of "stupid" bugs in your code. Off-by-one is still possible, obviously (although Ada can even catch some instances of this, where types are well-defined and the off-by-one results in a range check exception), and some other things...
Ada also supports exceptions, and a somewhat strict variation on inheritance using extensible records:
type oldRec is record oldField : Integer; end record;
type newRec is new oldRec with record newField : Integer; end record;
(newRec will have two fields: oldField and newField).
Disclaimer: I did not run the above code through an Ada compiler, so it is quite possible there were some errors in that code... but I'm sure it's pretty close.
- ----------------------------------------------------------- Frank D. Engel, Jr. fde101@fjrhome.net
$ ln -s /usr/share/kjvbible /usr/manual $ true | cat /usr/manual | grep "John 3:16" John 3:16 For God so loved the world, that he gave his only begotten Son, that whosoever believeth in him should not perish, but have everlasting life. $
___________________________________________________________ $0 Web Hosting with up to 120MB web space, 1000 MB Transfer 10 Personalized POP and Web E-mail Accounts, and much more. Signup at www.doteasy.com