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=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,f25e853f410d55da X-Google-Attributes: gid103376,public From: kilgallen@eisner.decus.org (Larry Kilgallen) Subject: Re: Dynamicly declaring arrays (was: Time to join the fold?) Date: 1999/02/01 Message-ID: <1999Feb1.121650.1@eisner>#1/1 X-Deja-AN: 439421637 X-Nntp-Posting-Host: eisner.decus.org References: <78abg4$cnc$1@its.hooked.net> <78i8s4$hth$1@its.hooked.net> <78iq2m$br9$1@nnrp1.dejanews.com> <794gg7$ib$1@nnrp1.dejanews.com> X-Trace: news.decus.org 917889414 15468 KILGALLEN [192.67.173.2] Organization: LJK Software Reply-To: Kilgallen@eisner.decus.org.nospam Newsgroups: comp.lang.ada Date: 1999-02-01T00:00:00+00:00 List-Id: In article <794gg7$ib$1@nnrp1.dejanews.com>, dennison@telepath.com writes: > I'm not entirely sure I can defend this aversion to declare blocks in a > rational way, so if anyone has a rationale as to why its perfecly acceptable > to have declare blocks liberally sprinkled throught their code, I'm all ears. I use declare blocks for objects that are only of very local interest because it makes it clear to the reader that there is no need to look elsewhere for any references. Perhaps subconsciously I think I may be adding runtime efficiency, but obviously compilers could do this work as well with "just in time" initialization in order to avoid initialization overhead during those invocations which will never use the object. I have no guarantee that would be a priority for compiler implementers, and in one recent situation I had decided _not_ to use declare blocks because initialization of some rarely-used objects was tricky enough that I wanted to initialize every time, to maximize the chances of run-time error detection even if the path using the object would not be traversed. It worked -- a defect in my data assumptions was detected on a run where the object would not actually have been used. Larry Kilgallen