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!news3.google.com!news.glorb.com!newsfeed.inode.at!news.hispeed.ch!linux2.krischik.com!news From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: private types Date: Sun, 19 Mar 2006 17:34:38 +0100 Organization: Cablecom Newsserver Message-ID: <1172812.9zPbPKbdVq@linux1.krischik.com> References: <1142279908.327131.230200@j52g2000cwj.googlegroups.com> <1259548.CMTukHGvVZ@linux1.krischik.com> NNTP-Posting-Host: 84-74-134-212.dclient.hispeed.ch Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8Bit X-Trace: news.hispeed.ch 1142786711 26971 84.74.134.212 (19 Mar 2006 16:45:11 GMT) X-Complaints-To: news@hispeed.ch NNTP-Posting-Date: Sun, 19 Mar 2006 16:45:11 +0000 (UTC) User-Agent: KNode/0.10.1 Xref: g2news1.google.com comp.lang.ada:3452 Date: 2006-03-19T17:34:38+01:00 List-Id: Bj�rn Persson wrote: > Peter C. Chapin wrote: >> Martin Krischik wrote in >> news:1259548.CMTukHGvVZ@linux1.krischik.com: >>>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). >> >> The C/C++ standard does not require NULL pointers to be represented by >> all zero bits either. The null pointer constant, (void*)0, might be >> translated into 0xFFFFFFFF or some other value. > > Well, does the standard require that (void*)0 == NULL? Before I learned C++ in deeps I thought the same. But then I read that the use of #define NULL is depreciated C++ and that one should use a simple 0 instead. > What if I wanted > a pointer to address zero on this hypothetical OS? That too is an interesting point. Actually dereference to (char*)0 is not forbidden - you will get the content of memory element 0x0. And when I did C work on systems without an MMU and the memory protection this was a serious problem. (char*)NULL would return data. Modern OS don't map the first memory page to the process so access will result in an error. But they only do that to ease up C/C++ development. There is no other reason. > How would I get that > if (void*)0 gets transformed to a non-zero NULL? Interesting question. Martin -- mailto://krischik@users.sourceforge.net Ada programming at: http://ada.krischik.com