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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: a07f3367d7,caabf5265fad78e5 X-Google-Attributes: gida07f3367d7,public,usenet X-Google-NewGroupId: yes X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!cyclone1.gnilink.net!gnilink.net!wn11feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail Newsgroups: comp.lang.ada From: anon@anon.org (anon) Subject: Re: Learning Ada Reply-To: anon@anon.org (anon) References: <59O1m.404661$4m1.69194@bgtnsc05-news.ops.worldnet.att.net> X-Newsreader: IBM NewsReader/2 2.0 Message-ID: Date: Thu, 09 Jul 2009 22:28:07 GMT NNTP-Posting-Host: 12.65.108.27 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1247178487 12.65.108.27 (Thu, 09 Jul 2009 22:28:07 GMT) NNTP-Posting-Date: Thu, 09 Jul 2009 22:28:07 GMT Organization: AT&T Worldnet Xref: g2news2.google.com comp.lang.ada:6926 Date: 2009-07-09T22:28:07+00:00 List-Id: If Ada RM A.2 ( 4 ), applied here, then Adacore / GNAT would not allow one to compile the a Standard package. When compiling the Ada.* you must use "-gnatpg", command option, but compiling the Standard package is as easy as compiling any non-vendor or Ada package. Actually I wrote the complete Standards package for both Ada 83 and 95 including a body that use System.Machine_Code for the routines base on the Ada 83 and Ada 95 specs. And these routines could be used for embeded processors, but the main code would still be generated by the GCC backend. In , "Frank J. Lhota" writes: >anon wrote: >> Yes, I did redefine apart of Standard. Found this out back in the mid 1990 >> while testing GNAT 3.0x for a number of projects. Its also, one way (not the >> best, but it is quick) of porting code from a 32-bit system down to a 16 or >> 8 bit system. Like using Intel Core i7 system to write code for an Intel >> 8086 system, which can use the same basic (non-protective mode) >> instruction set. > >No, you did not re-define a part of Standard. Keep in mind that all of >the compilation units you write is enclosed in the Standard package. As >a result, every Ada name can be expanded to something of the form >"Standard.*". > >When you wrote the package Standard as presented above, what you really >did was add a package named Standard *within* the pre-defined package >Standard, i.e. the result was something like this: > >-- Ada LRM Standard >package Standard is > > ... > type Integer is range ...; > ... > > -- Your Standard package > package Standard is > type INTEGER is range - 2 ** 63 .. ( 2 ** 63 ) - 1 ; > end Standard; > >end Standard; > >In other words, you've created the new type Standard.Standard.Integer, >which is a separate type from Standard.Integer. > >> Also, rewriting any Ada package is allowable within the scope of the RM >> (in some implementation it maybe required). And if I add a body for the >> Standard package and uncommented the an operators I could of made the >> operator do what I wanted it to do. Like having all Boolean operators >> return FALSE. > >LRM A.2 (4) specifically prohibit the compilation of a child of package >Ada in standard mode. I believe that some implementations would squawk >if you tried to replace parts of System, especially since doing so could >break other pre-defined units. > >> This process does not hide the built-in Standard package, its still there for >> the system to handle the other types, such as the Character or >> Wide_Character set, which can be a headache to define. > >Well, it does create some confusion. I would definitely *not* recommend >naming a unit Standard. > >> >> In , AdaMagica writes: >>> Oh my dear anon, you are so wrong again. >>> >>>> package STANDARD is >>>> >>>> =A0 -- The universal type universal_integer is predefined. =A0 >>>> >>>> =A0 type INTEGER is range - 2 ** 63 .. ( 2 ** 63 ) - 1 ; >>>> >>>> end STANDARD; >>> You do *not* redefine Standard with this declaration, you simply hide >>> it. >>> >>> with Standard; >>> >>> procedure Temp is -- Here you will get into troubled water. >>> >>> X: Integer; -- this is still the integer from the predefined >>> package Standard >>> Y: STANDARD.Integer; -- this is your INTEGER >>> >>> use Standard; >>> >>> Z: Integer :=3D 2; -- oh lord, what's this now? >>> >>> -- I'm not sure and I'm reluctant to do the RM exegesis to find out. >>> I *guess* it's your INTEGER; >>> >>> I: Integer :=3D Z**3; -- subtype of 3 is still the Integer defined in >>> -- the predefined Standard you've hidden >>> J: Integer :=3D Z**Z; -- This should then be illegal because the >>> subtype of the right operand of ** >>> -- must be the one from the hidden Standard. >>> >>> end Temp; >>> >>> Point is: You cannot redefine Standard! Full stop. >>> >>> I invite you to find the relevant paragraphs in the RM which state >>> what will happen when you define a package named Standard. >>> >>> And please be careful to not mix up a subtype and the type of the >>> subtype and the type of numeric literals. They are all different. >> > > >-- >"All things extant in this world, >Gods of Heaven, gods of Earth, >Let everything be as it should be; >Thus shall it be!" >- Magical chant from "Magical Shopping Arcade Abenobashi" > >"Drizzle, Drazzle, Drozzle, Drome, >Time for this one to come home!" >- Mr. Wizard from "Tooter Turtle"