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, MSGID_RANDY 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 Dewar Subject: Re: Portability questions Date: 2000/04/25 Message-ID: <8e55k5$52s$1@nnrp1.deja.com>#1/1 X-Deja-AN: 615646015 References: <3904A339.887711C1@ftw.rsc.raytheon.com> X-Http-Proxy: 1.0 x35.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Tue Apr 25 22:19:00 2000 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.61 [en] (OS/2; I) Date: 2000-04-25T00:00:00+00:00 List-Id: In article , Robert A Duff wrote: > 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. Why do you think that? This is a case where the quality and efficiency of the code is greatly improved by making sure that there are no unused garbage bits in the value, which can otherwise happen with packed arrays. This is very similar to the trade off choice of whether to clear garbage bits in records to speed up record comparisons. > 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. Most certainly pragma Import suppresses the initialization, and I find Bob's "not sure" here odd. This is one of the cases in which GNAT gives a helpful warning: Warning: default initialization of x may modify overlaid storage Warning: packed array components will be initialized to zero Warning: Use pragma Import for x to suppress initialization RM B.1(24) As you see, this is a case where GNAT includes the RM reference, and it seems clear enough, no? 24 The declaration of an imported object shall not include an explicit initialization expression. Default initializations are not performed. > Then there's pragma Normalize_Scalars, which probably has some > effect on all this. NS certainly causes more default initialization :-) Robert Dewar Sent via Deja.com http://www.deja.com/ Before you buy.