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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,c1131ea1fcd630a,start X-Google-Attributes: gid103376,public From: Steve O'Neill Subject: To Initialise or not Date: 1996/04/29 Message-ID: <318508FE.204B@sanders.lockheed.com>#1/1 X-Deja-AN: 152060778 content-type: text/plain; charset=us-ascii organization: Sanders, A Lockheed-Martin Company mime-version: 1.0 newsgroups: comp.lang.ada x-mailer: Mozilla 2.01 (Win16; I) Date: 1996-04-29T00:00:00+00:00 List-Id: Robert A Duff wrote: > In article <318109B1.3B54AFBF@escmail.orl.mmc.com>, > Theodore E. Dennison wrote: > >I suspect it is silent on this issue, because the Ada (83) LRM is > >NOT silent on the issue. Section 3.2.1(18) reads: > >"The execution of a program is erroneous if it attempts to evaluate a > > scalar variable with an undefined value." > > My personal coding convention is to *not* initialize variables if I know > they will be properly initialized later. Another situation where initialization is ill-advised is when dealing with memory-mapped hardware registers. It could be disastrous to write initial values to such a register which is 'pre-initialized' by the hardware. This is obviously a special case, but one that should not be ignored when dictating that all variables be initialized by the software (either by developers or automatically). > As an aside, I always write ":= null;" when I want to *rely* on the > initial value of a pointer, even though I know that pointers are always > default-initialized to null. You're not the only one. :) -- Steve O'Neill | "No,no,no, don't tug on that! Sanders, A Lockheed Martin Company | You never know what it might smoneill@sanders.lockheed.com | be attached to." (603) 885-8774 fax: (603) 885-4071| Buckaroo Banzai