🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #2609

Re: Report on defect in M2 vs C (Was Modula-2, Modula-3, C or C++)

#2609
From: Viet-Trung Luu
Date: Wed, 11 Oct 1995 17:35
28 lines
2105 bytes
On Tue, 10 Oct 1995, Robert A Duff wrote:

> No, I don't think it's true (that checking in C/C++ is the same as in
> other languages).  For example, in C, a variable declared as
> pointer-to-something might be the sort of pointer that links through
> heap objects (a linked list, or whatever), or it might be the sort of
> pointer that steps through an array.  It's very difficult (and in the
> general case, impossible), to tell which is which.  So, for a C compiler
> to check array bounds, it has to include several words of extra dope
> with every pointer, just in case it *might* be the sort that steps
> through an array.  Other languages (e.g., Ada, Pascal, etc) make this
> bounds-checking much simpler, and much more efficient.

Yes, I agree. However, that's if you think it's necessary to check 
*everything*. Does anyone know how bullet-proof the checking in other 
languages is?

> But is that "freedom" useful?  If you know ahead of time that you're
> indexing into an array, why not tell the compiler (or bounds-checking
> tool)?

Sometimes, but it's probably not worth the cost. Remember that I never 
claimed that such "freedom" is a good thing -- I'd rather have bug-free, 
easy-to-maintain programs. However, I *did* say that I like C's syntax in 
general, and didn't like the more verbose (IMHO) syntax of other 
languages, in general.

- Trung
Technical Details
Message-ID: <Pine.SUN.3.91.951011133320.1821B-100000@lagrange.uwaterloo.ca>
Path: arc1-ca.pugleaf.net!lagrange.uwaterloo.ca!vluu
References: <Pine.SUN.3.91.951010144335.13726A@lagrange.uwaterloo.ca> <DG920p.L2K@world.std.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.lang.modula2,comp.lang.modula3,comp.lang.c,comp.lang.c++,comp.lang.ada
Path: arc1-ca.pugleaf.net!lagrange.uwaterloo.ca!vluu
From: Viet-Trung Luu <vluu@lagrange.uwaterloo.ca>
Subject: Re: Report on defect in M2 vs C (Was Modula-2, Modula-3, C or C++) 
Sender: news@undergrad.math.uwaterloo.ca (news spool owner)
Message-ID: <Pine.SUN.3.91.951011133320.1821B-100000@lagrange.uwaterloo.ca>
In-Reply-To: <DG920p.L2K@world.std.com> 
Date: Wed, 11 Oct 1995 17:35:49 GMT
Content-Type: TEXT/PLAIN; charset=US-ASCII
References: <Pine.SUN.3.91.951010144335.13726A@lagrange.uwaterloo.ca> <DG920p.L2K@world.std.com> 
Nntp-Posting-Host: lagrange.uwaterloo.ca
Mime-Version: 1.0
Organization: University of Waterloo