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,80bc3e0698be468f X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!news.glorb.com!wn13feed!worldnet.att.net!bgtnsc05-news.ops.worldnet.att.net.POSTED!53ab2750!not-for-mail From: Dave Thompson Newsgroups: comp.lang.ada Subject: Re: Type safety on wikipedia Message-ID: References: <1138260496.230283.147640@g43g2000cwa.googlegroups.com> <1138283608.433842.76060@z14g2000cwz.googlegroups.com> <87fynaajuh.fsf@mid.deneb.enyo.de> <1138322309.525464.253320@z14g2000cwz.googlegroups.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Mon, 06 Feb 2006 05:02:15 GMT NNTP-Posting-Host: 12.75.255.155 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc05-news.ops.worldnet.att.net 1139202135 12.75.255.155 (Mon, 06 Feb 2006 05:02:15 GMT) NNTP-Posting-Date: Mon, 06 Feb 2006 05:02:15 GMT Organization: AT&T Worldnet Xref: g2news1.google.com comp.lang.ada:2788 Date: 2006-02-06T05:02:15+00:00 List-Id: On 26 Jan 2006 16:38:29 -0800, "jimmaureenrogers@worldnet.att.net" wrote: > The problem is one of attempting to dereference a null access object. > The above program compiles without error. > The actual problem is a dangling access (pointer) not a null one, as already noted elsethread. > When run, I get [CONSTRAINT_ERROR]... > It appears that Ada's runtime checks detect an erroneous problem. ... Yes, at least by default. > In C, while it is an error to de-reference a null pointer, the runtime > system > does nothing to detect the problem. C programs continue with really > nasty > garbage values. > Yes and no. The C standard leaves it up to the implementation. On some (increasingly many) systems with virtual memory where it is easy (enough) to leave page (or even segment) 0 unmapped, it will give a clear error, usually even a recoverable signal (roughly like the exception in Ada). On some (other) systems, (virtual) 0 is accessible (and accessed) but is reserved and initialized with "useful" data, such as 4 bytes of zero which in the most common read cases (as a string, char, or int) gives a safe and possibly even useful result. But you can't portably rely on, or enforce, this; and garbage is certainly a possibility. - David.Thompson1 at worldnet.att.net