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,ae9506fd4dcf7090 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-22 07:49:31 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!uunet!sea.uu.net!ash.uu.net!world!news From: Robert A Duff Subject: Re: Concatenation and Characters User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Sender: news@world.std.com (Mr Usenet Himself) Message-ID: Date: Tue, 22 Oct 2002 14:48:38 GMT Content-Type: text/plain; charset=us-ascii References: <44hp9.807$_u6.205@nwrddc01.gnilink.net> <3DA5AE5F.3030902@attbi.com> <3DB03EF1.EE771923@mmm.com> <3DB43EB0.AAF4B38C@mmm.com> <3DB44B9C.80007@worldnet.att.net> <3DB466CB.7CE0BC59@mmm.com> <3DB4C9C4.1070003@worldnet.att.net> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Organization: The World Public Access UNIX, Brookline, MA Xref: archiver1.google.com comp.lang.ada:30033 Date: 2002-10-22T14:48:38+00:00 List-Id: Jim Rogers writes: > One of the reasons default initialization is difficult for numerics > in Ada is because Ada allows you to define your own numeric types. > This means that the language cannot assume any particular value is > always a correct value for any numeric type. True. In fact, what would you like as the default initial value of this: X: Integer range 1..0; ? > Note that the 'Valid attribute can be checked before accessing any > variable. This attribute returns TRUE when the variable contains a > valid value and FALSE when the variable contains an invalid value. Not "any variable" -- it doesn't work for composite types. Anyway, 'Valid is irrelevant to the problem of uninitialized variables. It's silly to check 'Valid of all your variables -- much easier to make sure they are initialized properly. 'Valid is for validating input data, not for detecting program bugs. By the way, it's interesting that a pre-1983 version of Ada (or maybe it was called Green then) required run-time detection of uses of uninitialized variables -- an exception was raised. I presume they got rid of that because of concerns about run-time speed (or lack of it). I think that was a mistake: you could always use pragma Suppress if you need the speed. This decision (the trade-off between the debugging aid and speed) should be in the hands of the programmer, not the language designer. Another issue with run-time detection is that it sometimes requires extra bits to be allocated, which might mess up representations (e.g., if you're interfacing to hardware). - Bob