Newsgroups: comp.lang.c++,comp.lang.smalltalk,comp.object
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!news.sprintlink.net!EU.net!Austria.EU.net!attsun!cett.alcatel-alsthom.fr!slsv6bt!news
From: kanze@us-es.sel.de (James Kanze US/ESC 60/3/141 #40763)
Subject: Re: C++ Productivity (& typing & trustworthiness)
In-Reply-To: x1gsd@dax.cc.uakron.edu's message of 6 Feb 1995 13:59:40 GMT
Message-ID: <KANZE.95Feb8154208@slsvhdt.us-es.sel.de>
Lines: 40
Sender: news@lts.sel.alcatel.de
Organization: SEL
References: <1995Jan23.193745.7044@boole.com> <1995Feb3.172403.2977@rcmcon.com>
	<3h178j$nrq@panix.com> <nagleD3IFGn.wD@netcom.com>
	<3h5a0c$sqt@kira.cc.uakron.edu>
Date: 08 Feb 1995 14:42:08 GMT
Xref: glinda.oz.cs.cmu.edu comp.lang.c++:111751 comp.lang.smalltalk:20587 comp.object:26405

In article <3h5a0c$sqt@kira.cc.uakron.edu> x1gsd@dax.cc.uakron.edu
(Gregory S Delozier) writes:

|> Back on topic: I've been using Pascal- and Oberon-like languages for some
|> time precisely because of the strong typing and clean module definition
|> semantics of these languages.  During this time, what C has had to offer
|> has basically been the xxx.h included header file to allow some form of
|> type-checking w.r.t. the contents of a linked-to module. In my
|> experience, in large projects the header files get put in one place and
|> the code in another, and its easy to get them into an inconsistent
|> state, so that eventually a function gets called using an inaccurate 
|> header definition and all hell breaks loose. (FWIW, I've coded and
|> delivered about 100KLOC in C, so I've run into this on quite a few
|> occasions.)

|> OTOH, in Ada, or Oberon, or Turbo Pascal, this is a non-issue. 
|> A non-existent or inconsistent interface spec is a compile-time
|> error, (or a link-time error.)

Just for the record, this is a quality of implementation issue in C++.
An inconsistent interface specification is (generally) a violation of
the so-called one definition rule: the results are undefined, so it is
legal for the implementation to generate an error.

Interestingly enough, it isn't that difficult either, at least if you
are willing to accept a 95% job.  I have yet to understand why
compiler vendors don't simply put a hash code of the tokens in each of
the include .h files in the object file.  The linker checks that all
of the hash codes for a given .h file are identical, and outputs a
warning if they aren't.

This is obviously far from perfect, but compared to what we now
have...  And really, it shouldn't be that difficult, should it?
-- 
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


