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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,47208e1e64e89fe0,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-10-10 06:12:02 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: prichtmyer@yahoo.com (Peter Richtmyer) Newsgroups: comp.lang.ada Subject: Null Record is not always Null Date: 10 Oct 2002 06:12:01 -0700 Organization: http://groups.google.com/ Message-ID: <1b585154.0210100512.54af8543@posting.google.com> NNTP-Posting-Host: 164.223.72.6 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1034255521 17041 127.0.0.1 (10 Oct 2002 13:12:01 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 10 Oct 2002 13:12:01 GMT Xref: archiver1.google.com comp.lang.ada:29654 Date: 2002-10-10T13:12:01+00:00 List-Id: This is a little on the light side, but is also frustrating to see in "portable Ada". Perhaps others with different compilers will find even different results. ----------------------------------------------------- with Text_Io; procedure nil is type nul is null record; for nul'size use 0; nil : nul; type aray is array (1 .. 1000) of nul; -- pragma pack (aray); -- line 7 -- for aray'size use 0; -- line 8 ary : aray; type dbl is array (1 .. 1000) of aray; -- pragma pack (dbl); -- line 11 -- for dbl'size use 0; -- line 12 dub : dbl; begin text_io.put_line ("Nil size = " & integer'image(nil'size)); text_io.put_line ("Ary size = " & integer'image(ary'size)); text_io.put_line ("Dub size = " & integer'image(dub'size)); -------------------------------------------- -- output on Gnat 3.14p (win2000): -- Nil size = 8 -- Ary size = 8 -- Dub size = 8 -------------------------------------------- -- Rational Apex Ada 95 v. 4.0.0b (Solaris) -- (would not compile until I commented out lines 8 & 12) -- 06:39:44 AM >>> Line 8: for Aray'Size use 0; -- 06:39:44 AM *** Specified size 0 is too small for array (1 .. 1000) of Nul -- 06:39:44 AM ++* nil.2.ada has failed to install in ... -- 06:39:50 AM +++ 1 unit was parsed -- 06:39:50 AM ++* 1 unit could not be installed -- -- Rational output with lines 8 & 12 commented out: -- Nil size = 0 -- Ary size = 1000 -- Dub size = 1000000 -------------------------------------------- -- Aonix ObjectAda 7.1.105 Professional Version (win2000) -- (Would not compile. Window said:) -- Program Error -- ADACOMP.exe has generated errors and will be closed by -- Windows. You will need to restart the program. -- An error log is being created. -- It did not close. I could not find an error log. -- In order to even start compiling, I had to comment lines 7,8,11,12 -- Then output was: -- Nil size = 0 -- Ary size = 0 -- Dub size = 0 -- which is what I wanted! --------------------------------------------- end nil; ----- Don't know if there is a "right" result, or is this one of those gray areas. Anybody? Peter