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!news4.google.com!border1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!peer01.cox.net!cox.net!news-out.ntli.net!newsrout1-gui.ntli.net!ntli.net!news.highwinds-media.com!newspeer1-win.ntli.net!newsfe5-gui.ntli.net.POSTED!53ab2750!not-for-mail From: "Dr. Adrian Wrigley" Subject: Re: private types User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Message-Id: Newsgroups: comp.lang.ada References: <1142279908.327131.230200@j52g2000cwj.googlegroups.com> <1259548.CMTukHGvVZ@linux1.krischik.com> <9006286.GT9LdmDZaR@linux1.krischik.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: Sun, 19 Mar 2006 20:43:42 GMT NNTP-Posting-Host: 82.10.238.153 X-Trace: newsfe5-gui.ntli.net 1142801022 82.10.238.153 (Sun, 19 Mar 2006 20:43:42 GMT) NNTP-Posting-Date: Sun, 19 Mar 2006 20:43:42 GMT Organization: NTL Xref: g2news1.google.com comp.lang.ada:3468 Date: 2006-03-19T20:43:42+00:00 List-Id: On Sun, 19 Mar 2006 20:20:52 +0100, Martin Krischik wrote: > Robert A Duff wrote: > >> 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. > > Super! And how many (in %) of C++ programmer actually know that. By guess is > 0.1%. And indeed I is the main problem: Only a very few C/C++ programmers > actually master the language. It is (or was) quite a common interview question, to see if C (and C++) programmers know their subject properly. As you say, Robert, most don't. A related topic is the issue of pointer representation, which (IIRC) says that pointers to char (any kind) and void have to be the same. Pointers to functions have to be the same. But all other pointers can have their own representation. All pointers can be converted to and from pointers to void, without loss. And pointers can have different sizes and different patterns for the null pointer. I suspect a lot of code would fail if compilers wanted to exercise their full freedoms! -- Adrian