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,dbcfe2b0a74da57e X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!news2.google.com!newsfeed2.dallas1.level3.net!news.level3.com!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: Inherited Methods and such Date: Wed, 26 Sep 2007 08:21:45 -0400 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1190213376.707449.146640@g4g2000hsf.googlegroups.com> <1fl2wnziigxfd.1fjbag2hh8sbc$.dlg@40tude.net> <1190239986.762473.204290@k79g2000hse.googlegroups.com> <1rw45b3rmvmcr$.1df4wst5oknbl$.dlg@40tude.net> <1190296353.624737.150940@y42g2000hsy.googlegroups.com> <11m13st1f92kf$.m8s6y8mc8ebk.dlg@40tude.net> <1190321119.206313.65290@57g2000hsv.googlegroups.com> <1190408526.100291.265040@50g2000hsm.googlegroups.com> <9ukf2wtqjs0q$.iuijmal4x56b$.dlg@40tude.net> <1190497995.498679.119190@19g2000hsx.googlegroups.com> <1mw3qju08q8uj.sgzht7ld9ydc$.dlg@40tude.net> <1190579805.451187.71140@d55g2000hsg.googlegroups.com> <1i8ksr774bjbj.vpmnx3c0i9qz.dlg@40tude.net> <1190646125.024072.310020@19g2000hsx.googlegroups.com> <1r9s9v6pcjifl.vp4ktk0unpd1.dlg@40tude.net> <1190753631.240548.101820@19g2000hsx.googlegroups.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: pcls4.std.com 1190809305 17402 192.74.137.71 (26 Sep 2007 12:21:45 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Wed, 26 Sep 2007 12:21:45 +0000 (UTC) User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/21.3 (irix) Cancel-Lock: sha1:DzfAtesvoz91v4xbkRQr8HD5dfg= Xref: g2news2.google.com comp.lang.ada:2138 Date: 2007-09-26T08:21:45-04:00 List-Id: Maciej Sobczak writes: > The above program prints 0 as the value of an object which type is > range 10 .. 20. Well, it happens to print 0 in one implementation. According to the RM, this is a bounded error, and it could just as well raise an exception (or print some other bogus value). Is this something fundamentally broken about constructors, or is just another case of uninitialized variables? I mean, there are lots of other ways to create uninit vars in Ada... > What's even more funny, I can add the following inside Some_Operation > for S: > > declare > J : R := X.I; -- at this point X.I = 0 > begin > Put (R'Image (J)); > end; > > Guess what will happen. No constraint_error and 0 is assigned to J. ^^^^ might > Why? Because the poor compiler assumed that if X.I is of type R, then > no checks are necessary. Right. Or it might raise an exception. I don't find this "more funny" -- it's equally funny as the previous case of printing 0. - Bob