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,14763ec3b19ef1d6 X-Google-Attributes: gid103376,public From: Robert A Duff Subject: Re: Portability questions Date: 2000/04/25 Message-ID: #1/1 X-Deja-AN: 615462502 Sender: bobduff@world.std.com (Robert A Duff) References: <3904A339.887711C1@ftw.rsc.raytheon.com> Organization: The World Public Access UNIX, Brookline, MA Newsgroups: comp.lang.ada Date: 2000-04-25T00:00:00+00:00 List-Id: Wes Groleau writes: > An annotation in the AARM points out that initializations > are not suppressed by address clauses. Right. If you want to avoid default initializations, use pragma Import, in addition to the address clause. I think Annex B says something about that. > 1. Is there any place in the official RM that says that? > (I have used the argument "it says over here that this > happens. It doesn't say there are any exceptions.") That's the right argument. After all, how do we know that making a variable name start with Q doesn't cause initializations to be skipped? Because the RM doesn't say otherwise. ;-) > 2. How does this apply or not apply to initializations > that are NOT required by the language? For example, > > type Byte is range 0 .. 255; > for Byte'Size use 8; > > type Buffer is array (Positive range <>) of Byte; > pragma Pack (Buffer); > > B : Buffer (1..Length_Of_Message); > for B'Address use Address_Of_Message; > > -- compiler A fills the space of any declared buffer with > -- zeroes. The language does not require this. How does > -- erasing the received message fit with the Ada 95 rules? Without pragma Import, the compiler can do what it likes -- initialize B or not. I suspect most compilers do not. I think compilers should not. With pragma Import on B, I would consider it a bug for a compiler to initialize B, although I'm not sure I can prove that from the RM. Then there's pragma Normalize_Scalars, which probably has some effect on all this. - Bob