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,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 2002:a5e:8a07:: with SMTP id d7mr2087061iok.7.1554989464134; Thu, 11 Apr 2019 06:31:04 -0700 (PDT) X-Received: by 2002:aca:48d0:: with SMTP id v199mr5185824oia.51.1554989463158; Thu, 11 Apr 2019 06:31:03 -0700 (PDT) Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!news.uzoreto.com!news.muarf.org!nntpfeed.proxad.net!proxad.net!feeder1-2.proxad.net!209.85.166.215.MISMATCH!b2no143253itd.0!news-out.google.com!w17ni152itb.0!nntp.google.com!b2no143247itd.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Thu, 11 Apr 2019 06:31:02 -0700 (PDT) In-Reply-To: <565a03a8-9194-4814-b21c-a5b61b8185b7@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2a02:c7d:3c35:b000:325a:3aff:fe0f:37a5; posting-account=L2-UcQkAAAAfd_BqbeNHs3XeM0jTXloS NNTP-Posting-Host: 2a02:c7d:3c35:b000:325a:3aff:fe0f:37a5 References: <565a03a8-9194-4814-b21c-a5b61b8185b7@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <726b06b2-c752-4f8f-a2d4-0aee2405e76e@googlegroups.com> Subject: Re: Why can't objects be static in Ada? From: Lucretia Injection-Date: Thu, 11 Apr 2019 13:31:04 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader01.eternal-september.org comp.lang.ada:56115 Date: 2019-04-11T06:31:02-07:00 List-Id: On Thursday, 11 April 2019 13:56:18 UTC+1, Mark Lorenzen wrote: > > Why can't Zero_Size be compiled as static in this pre-elaborated package? > > > > This seems to be a major flaw in Ada imo. > > > > Luke. > > I don't think it's not an Ada flaw. From an Ada perspective the object is constant - irrespective if it's static (it's value is set at compile-time) or not. Your double negative here makes this hard to understand. > I guess it's compiler-dependent. There are a number of cases where GNAT could be better at generating static objects. This is especially true for objects of a (discriminated) record type. > > Try adding "Restrictions (No_Elaboration_Code)" to the spec and see if it forces GNAT into doing what you want to. Doesn't like that pragma in the context area or inside the package, inside gnat.adc it's fine, but I get the same error, i.e. non-static.