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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,5978c98b23dbfa0b X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Received: by 10.68.75.170 with SMTP id d10mr7139805pbw.6.1324538832994; Wed, 21 Dec 2011 23:27:12 -0800 (PST) Path: lh20ni50802pbb.0!nntp.google.com!news1.google.com!postnews.google.com!p16g2000yqd.googlegroups.com!not-for-mail From: Adam Beneschan Newsgroups: comp.lang.ada Subject: Re: Debugging Ada Date: Wed, 21 Dec 2011 23:21:19 -0800 (PST) Organization: http://groups.google.com Message-ID: References: <4b7ed906-dfbb-4f73-826e-f1c94ec320e7@k10g2000yqk.googlegroups.com> <5567da15-bd12-4dee-be27-b98525ea1323@x19g2000yqf.googlegroups.com> <1fcdb3e7-6125-4cdc-9514-dd3cff2a7350@h3g2000yqa.googlegroups.com> <0892748e-8943-41e3-8843-9121838b4465@f33g2000yqh.googlegroups.com> <56da68a5-1d00-4ec7-863b-c9a2a7a64f95@l19g2000yqc.googlegroups.com> <87zkelvhbr.fsf@ludovic-brenta.org> NNTP-Posting-Host: 207.200.116.71 Mime-Version: 1.0 X-Trace: posting.google.com 1324538832 31750 127.0.0.1 (22 Dec 2011 07:27:12 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 22 Dec 2011 07:27:12 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p16g2000yqd.googlegroups.com; posting-host=207.200.116.71; posting-account=duW0ogkAAABjRdnxgLGXDfna0Gc6XqmQ User-Agent: G2/1.0 X-HTTP-Via: HTTP/1.1 (Velocity/3.1.2.1 [uScMs f p eN:t cCMp s ]), HTTP/1.1 spider-ntc-ta03.proxy.aol.com[CFC87003] (Prism/1.2.1), HTTP/1.1 cache-ntc-ab07.proxy.aol.com[CFC87447] (Traffic-Server/6.1.5 [uScM]) X-Google-Web-Client: true X-Google-Header-Order: ARLUECVH X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 7.0; AOL 9.5; AOLBuild 4337.5401; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; HPDTDF; BRI/1; .NET4.0C; BRI/2; AskTbARS/5.12.2.16749),gzip(gfe) Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Date: 2011-12-21T23:21:19-08:00 List-Id: On Dec 21, 11:46=A0am, Ludovic Brenta wrote: > awdorrin writes: > > Ah, I see what you are saying. I don't think that is what is going on > > in this situation. > > > The code I'm working with is a mix of Ada and C, and it was originally > > written under Ada83. > > > The 'SysConfig' package is importing a C character array: > > =A0 char g_cfg_file_names[100][128]; (up to 100 file names, 128 > > characters each) > > as: > > =A0 pragma Import( C, CFG_FILES, "g_cfg_file_names"); > > > LAN_CFG is part of an enumeration defined in the SysConfig package to > > map to the index numbers of that array. > > OK, I think I understand the problem better too. =A0Your initial > description of the problem was: > > > Then in the package's main procedure when I try to use the > > LAN_CFG_FILE, sometimes the value is corrupted. > > I'm beginning to think that perhaps the elaboration order varies between > compilations. =A0The pragma Import (C, CFG_FILES, "g_cfg_file_names") > indicates that: > > - the Ada language rules require that g_cfg_file_names is elaborated > =A0 before LAN_CFG_FILE > - the Ada compiler cannot enforce this rule, so it simply assumes that > =A0 the rule is followed > - the C compiler must emit code that elaborates *and* initializes > =A0 g_cfg_file_names. =A0It is possible that what you see as "corrupted" = is > =A0 simply an uninitialized value. > - the binder must emit code that calls the C initialization routine > =A0 *before* the elaboration of LAN_CFG_FILE If LAN_CFG_FILE is declared inside a procedure as shown in a previous post, how can elaboration order be an issue? -- Adam