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,9fb8e2af320d5b3e X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!feeder.news-service.com!newsfeed.freenet.de!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail Date: Fri, 29 Jun 2007 11:42:56 +0200 From: Georg Bauhaus Organization: elsewhere User-Agent: Thunderbird 1.5.0.12 (Macintosh/20070509) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Bus error References: <1182954233.788124.17920@c77g2000hse.googlegroups.com> <1182959120.13096.8.camel@kartoffel> <1182964748.689146.52490@c77g2000hse.googlegroups.com> <1183061209.600996.74710@k79g2000hse.googlegroups.com> <1183104348.439715.173430@q75g2000hsh.googlegroups.com> In-Reply-To: <1183104348.439715.173430@q75g2000hsh.googlegroups.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <4684d358$0$14887$9b4e6d93@newsspool4.arcor-online.net> NNTP-Posting-Date: 29 Jun 2007 11:39:36 CEST NNTP-Posting-Host: 3ed55043.newsspool4.arcor-online.net X-Trace: DXC==Nf:lRILob;n`gW2MTm]<34IUK Maciej Sobczak wrote: > > Yes, or even stricter: > > with Ada.Finalization; use Ada; > package P is > type T (<>) is limited private; > private > type T is new Finalization.Limited_Controlled with ...; > end P; > > which prevents uninitialized objects. Uhm, it prevents uninitialized objects that cannot otherwise have default initialisation (e.g. from function calls whose results are assigned to components), or initialisation via Initialize. Such as records that need their components initialised with values known only at run time *and* defined at library level etc. In a less flat architecture (which dismisses the possibilites of nested block structure :), consider a plain limited type T in some suitably nested block: procedure Operate_System_95 is type External_State is new Natural; outside: External_State; package P is type T is limited private; private type Void is null record; function Constructor(Object: access T) return Void; type T is limited record hook: Void := Constructor(T'access); count: Natural; end record; end P; package body P is function Constructor(Object: access T) return Void is begin Object.count := Natural(outside); return (null record); end Constructor; end P; V: P.T; -- initialisation via Constructor is guaranteed begin null; end Operate_System_95;