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,ec21c3c7cdc7ff3e X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newscon06.news.prodigy.com!prodigy.net!newsfeed-00.mathworks.com!nntp.TheWorld.com!not-for-mail From: Robert A Duff Newsgroups: comp.lang.ada Subject: Re: private types Date: 19 Mar 2006 13:15:03 -0500 Organization: The World Public Access UNIX, Brookline, MA Message-ID: References: <1142279908.327131.230200@j52g2000cwj.googlegroups.com> <1259548.CMTukHGvVZ@linux1.krischik.com> NNTP-Posting-Host: shell01.theworld.com Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8bit X-Trace: pcls4.std.com 1142792103 29212 192.74.137.71 (19 Mar 2006 18:15:03 GMT) X-Complaints-To: abuse@TheWorld.com NNTP-Posting-Date: Sun, 19 Mar 2006 18:15:03 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 Xref: g2news1.google.com comp.lang.ada:3455 Date: 2006-03-19T13:15:03-05:00 List-Id: Martin Krischik writes: > Justin Gombos wrote: > > > Zero has a > > universal meaning with access types, but it could be in range or out > > of range for any other type. �The ARM selects access types > > specifically to get a default initialization of zero for this reason. > > Who says that Null := 16#0#? I could image a Hardware/CPU/OS where it would > be better to define Null := 16#FFFF_FFFF_FFFF_FFFF#. The convention on TOPS-20 for null (in all the various languages that have it) is to use some address other than zero. I don't remember which address. The OS protects that page so it traps (just as most modern operating systems do for page zero). There was even an Ada compiler for TOPS-20, and of course it obeyed that convention. Using all-zero-bits for null has some minor efficiency advantages. > For example an OS who's Virtual Memory Management System assign address > 16#0# to be a valid address and to hold some important process data to > which the process needs access. > > Of course programming C or C++ on such an OS could be quite challenging > (Write to (void*)0 and you mess up your Proccess Information Descriptor). I believe the C++ rule is that 0 (written in your program) is the same thing as NULL -- but it need not be represented internally by all-zero-bits. Casting the integer zero to a pointer, however, does not necessarily result in NULL. That's sort of confusing, but if you understand the rules, the "quite challenging" comment above does not hold. - Bob