🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.modula2
Article #2626

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

#2626
From: James Kanze US/ESC 60/3/141 #407...
Date: Mon, 16 Oct 1995 16:37
22 lines
1952 bytes
In article <dewar.813699321@schonberg> dewar@cs.nyu.edu (Robert Dewar)
writes:

|>         char p[10], q[10];
|>         int r = &p[5] - &q[2];

|> this is plainly incorrect C, so this is not the kind of issue that arises
|> in bounds checking. THe problem is that pointers can be havily aliased 
|> in C, and I repeat my observation, without auxiliary data structures of som
|> e kind you can't tell if a pointer is a pointer to an integer or a pointer
|> to an element of an array, so you can't tell if it is valid to decrement it.

But there is nothing in the standard which prohibits the auxiliary
structure, and any operation which would normally result in a bounds
check error has undefined behavior, so a conforming C/C++
implementation with full bounds checking is possible.  In fact, I
believe that ObjectCenter actually sells such an implementation.
-- 
James Kanze         Tel.: (+33) 88 14 49 00        email: kanze@gabi-soft.fr
GABI Software, Sarl., 8 rue des Francs-Bourgeois, F-67000 Strasbourg, France
Conseils en informatique industrielle --
                              -- Beratung in industrieller Datenverarbeitung
Technical Details
Message-ID: <KANZE.95Oct16173746@slsvgqt.lts.sel.alcatel.de>
Path: arc1-ca.pugleaf.net!cett.alcatel-alsthom.fr!slsv6bt!news
References: <44hcri$rsm@theopolis.orl.mmc.com> <44rv1u$dfk@apollo.ekfido.kodak.com> <44uccq$lkd@theopolis.orl.mmc.com> <DFyAJF.KpC@research.att.com> <DAGENAIS.95Oct6084824@gutrune.vlsi.polymtl.ca> <dewar.813243156@schonberg> <45lj1i$o5i@frigate.doc.ic.ac.uk> <dewar.813699321@schonberg>

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!cett.alcatel-alsthom.fr!slsv6bt!news
From: kanze@lts.sel.alcatel.de (James Kanze US/ESC 60/3/141 #40763)
Subject: Re: Report on defect in M2 vs C (Was Modula-2, Modula-3, C or C++)
In-Reply-To: dewar@cs.nyu.edu's message of 14 Oct 1995 15:36:38 -0400
Message-ID: <KANZE.95Oct16173746@slsvgqt.lts.sel.alcatel.de>
Sender: news@lts.sel.alcatel.de
Organization: SEL
References: <44hcri$rsm@theopolis.orl.mmc.com> <44rv1u$dfk@apollo.ekfido.kodak.com>
 <44uccq$lkd@theopolis.orl.mmc.com> <DFyAJF.KpC@research.att.com>
 <DAGENAIS.95Oct6084824@gutrune.vlsi.polymtl.ca>
 <dewar.813243156@schonberg> <45lj1i$o5i@frigate.doc.ic.ac.uk>
 <dewar.813699321@schonberg>
Date: 16 Oct 1995 16:37:46 GMT