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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!newsfeed.kamp.net!newsfeed.kamp.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: hreba Newsgroups: comp.lang.ada Subject: Re: storage error: stack overflow Date: Tue, 18 Aug 2015 22:48:48 -0300 Message-ID: References: <87r3n0kc15.fsf@adaheads.sparre-andersen.dk> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net ufH/mdPv4nPemGQkGC/Heg4089y/YWiPJEK6DtvkuG3+4GvLa1 Cancel-Lock: sha1:egzDbmcFcw9Ou9kCgRVIzBCLGAc= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 In-Reply-To: Xref: news.eternal-september.org comp.lang.ada:27500 Date: 2015-08-18T22:48:48-03:00 List-Id: On 08/18/2015 11:16 AM, Jeffrey R. Carter wrote: > On 08/18/2015 07:02 AM, hreba wrote: >> >> Huh? As much as I know you cannot declare variables of a type with unknown >> storage requirements at compile time, such as class-wide types and arrays with >> unknown range. > > These are "indefinite types". You can declare an object of an indefinite type as > long as you supply an initialization expression: > > S : String := "Hello"; > > V : T'Class := Some_Function; > If the object is initialized, the storage requirement is known at compile type. My situation is a typical object orientation case as shown in a lot of examples where you have a (possibly abstract) base type and several extensions and where the dynamic type of a variable is not known at compile time. Classic example would be an inhomogeneous list (I know in practice you use a container for that, it is just an example). My knowledge of Ada exceeds Ada 95 only by very little but I am pretty sure that in such a case one uses variables of a class-wide type, and as one cannot initialize them one has to declare them as access types. Or, if I am wrong, what would be the best practice for that? -- Frank Hrebabetzky +55 / 48 / 3235 1106 Florianopolis, Brazil