comp.lang.ada
 help / color / mirror / Atom feed
From: Dave Thompson <david.thompson1@worldnet.att.net>
Subject: Re: Ada exception block does NOT work?
Date: Sat, 27 Aug 2005 21:09:17 GMT
Date: 2005-08-27T21:09:17+00:00	[thread overview]
Message-ID: <imk1h1dldtvrq553phl7eorebuiao9404h@4ax.com> (raw)
In-Reply-To: 5192868.ameRvq1EvN@linux1.krischik.com

On Tue, 23 Aug 2005 20:09:06 +0200, Martin Krischik
<krischik@users.sourceforge.net> wrote:

> Dennis Lee Bieber wrote:
> 
> > On Mon, 22 Aug 2005 19:32:01 -0500, Larry Elmore <ljelmore_@comcast.net>
> > declaimed the following in comp.lang.ada:
> > 
> >> 
> >> I'm not sure that's necessarily the case.  After all, Unix predates K&R
> >> and K&R C was certainly not the first version of C.
> >>
> > Pardon?
> > 
> > As I recall, Kernighan and Ritchie /defined/ the original C
> > language... The original UNIX was Ritchie and Thompson (and some
> > others)...
> 
> Well, K&R where programmers - so they likely first wrote the program (C
> compiler) and and then the book. If you go to Amazon now they will offer
> you the 2nd edition with ANSI-C.
> 
> So I guess that looking at he book won't tell you about the very first C.
> 
AIUI Kernighan was a tech writer then, although I believe by the time
of awk he moved into programming, and AFAICT had nothing to do with
the first compilers.  It's true K&R1-thebook was several years after C
was created; others have already pointed to the HOPL2 article
available along with other historical information on dmr's website.

> The one without function prototypes - you just had to hope the parameters
> are right (or use lint).
> 
> Just to remind you, main looked like this at the time
> 
> main (argn, argv, env)
>   int argn,
>   char** argv,
>   char** env
>   {
>   puts ("Hello World");
>   }
> 
Not quite. The parameter/formal declarations are (and were) like
normal variable declarations terminated by semicolon not separated by
comma; the default int could be used for argc which I believe was the
conventional (though not mandatory) spelling even back to the
beginning; and I'm pretty sure env was never mandatory:
[int] main (argc, argv [,env] )
  [int argc;] char **argv; [char **env;]
  /* or (yuckier?) char **argv, **env; */
  /* change spacing to taste */
{ body }

And I believe even the first Unix C had main() returning an exit code,
for which the (accidental) return value of puts() would not be
suitable, so a 'return 0;' is necessary. 

> And yes: no include, the compiler would guess for you how to call puts.
> 
True the preprocessor was not as early as the first compiler, but it
was by the first outside Unix distributions (well before the book) and
thus I believe before stdio, so there were declarations to #include if
you wanted. If not, the compiler doesn't guess, it takes fixed and
simple defaults, and most of the standard library routines including
puts() were not so accidentally designed so this default was correct.

> > One would think Ritchie, at least, might have had some insights into
> > the potential access problems <G> Even if there was a time-gap between
> > the two roles.
> 
> No he would not. Otherwise he would not have added:
> 
> * implicit type conversion.

Most other languages of the time convert numeric types at least as
freely as C -- FORTRAN and COBOL definitely; PL/I even more so; I
don't recall for algol. Pascal some but less, and I don't think there
were yet BASICs that distinguished integer from float. Pascal did have
enums distinct from integers. C was unusual, AFAIK unique still, in
treating char as just a small integer, and string as just a char array
with sentinel, which allows some conversions other languages don't.

> * implicit declaration of external functions.
> * implicit convertion from array to pointer.

That third was not really added, it was effectively carried forward
from BCPL and never removed.  Implicit int and implicit function
declaration were also apparently driven by BCPL-B-NB compatibility.
(AFAICT they don't simplify the compiler at all, if anything the
reverse, and don't simplify learning or using the language.)

> * implicit convertion from ponter to array.
> 
That doesn't exist. Unless you mean access from a pointer to an array
_element_.

> And he might have added:
> 
> * an optimiser
> 
> K&R probably where good assember programmers but they where lousy compiler
> builders. There was better (Algol, PL/1 etc. pp.) at the time.
> 
Not on machines the size (and cost) of a PDP-11, I don't think. Pascal
with fairly minor restrictions was done on -11 (UCSD) but AIR not
until some years later. (Original Pascal, and later the standard,
don't include all the low-level bit-bashing stuff C needed as a SIL,
but that could easily enough have been added; heck, there were
Fortrans with enough extensions for that.)

- David.Thompson1 at worldnet.att.net



  parent reply	other threads:[~2005-08-27 21:09 UTC|newest]

Thread overview: 78+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-16  8:48 Ada exception block does NOT work? bubble
2005-08-16  9:00 ` Georg Bauhaus
2005-08-16  9:32   ` bubble
2005-08-16  9:42     ` gautier_niouzes
2005-08-16 15:25       ` Frank J. Lhota
2005-08-16 16:58         ` Svesse
2005-08-16 17:48           ` Björn Persson
2005-08-16 18:12             ` Svesse
2005-08-16 18:17           ` Frank J. Lhota
2005-08-17 10:53         ` Ludovic Brenta
2005-08-17 11:34           ` Anders Wirzenius
2005-08-17 18:08             ` Björn Persson
2005-08-17 19:05               ` Randy Brukardt
2005-08-18 15:58               ` Georg Bauhaus
2005-08-16 12:30     ` Georg Bauhaus
2005-08-16 17:39       ` Björn Persson
2005-08-16 19:43         ` Georg Bauhaus
2005-08-17  1:39     ` Jeffrey R. Carter
2005-08-17  7:22       ` Maciej Sobczak
2005-08-18  1:05         ` Jeffrey R. Carter
2005-08-18  8:44           ` Maciej Sobczak
2005-08-18 11:40             ` Jean-Pierre Rosen
2005-08-18 12:56               ` Maciej Sobczak
2005-08-18 14:42                 ` Jean-Pierre Rosen
2005-08-18 18:03                 ` Martin Krischik
2005-08-18 13:15               ` Alex R. Mosteo
2005-08-18 15:23                 ` Dmitry A. Kazakov
2005-08-18 18:00                 ` Martin Krischik
2005-08-18 16:13             ` Jeffrey Carter
2005-08-18 16:38               ` Hyman Rosen
2005-08-18 18:07                 ` jimmaureenrogers
2005-08-18 18:44                   ` Hyman Rosen
2005-08-18 20:52                     ` Frank J. Lhota
2005-08-19  0:57                     ` jimmaureenrogers
2005-08-19  7:52                       ` Dmitry A. Kazakov
2005-08-19 14:41                       ` Robert A Duff
2005-08-19 17:48                   ` Martin Krischik
2005-08-19 14:58                 ` Robert A Duff
2005-08-18 17:54             ` Martin Krischik
2005-08-18 20:56             ` Robert A Duff
2005-08-18 22:01               ` Hyman Rosen
2005-08-19  2:35               ` Jeffrey R. Carter
2005-08-20 15:28                 ` Robert A Duff
2005-08-20 20:24                   ` Jeffrey R. Carter
2005-08-20 21:34                     ` Robert A Duff
2005-08-20 22:47                       ` Frank J. Lhota
2005-08-20 23:34                         ` Robert A Duff
2005-08-21 11:18                           ` Simon Wright
2005-08-21 16:59                             ` tmoran
2005-08-21 19:48                               ` Simon Wright
2005-08-21 16:07                           ` Frank J. Lhota
2005-08-21 16:23                           ` Martin Krischik
2005-08-21  1:12                       ` Björn Persson
2005-08-21  9:01                       ` Dmitry A. Kazakov
2005-08-21 16:14                       ` Martin Krischik
2005-08-21  4:02                     ` Larry Kilgallen
2005-08-19 12:34               ` Dr. Adrian Wrigley
2005-08-19 17:29                 ` Martin Krischik
2005-08-19 18:14                   ` Frank J. Lhota
2005-08-21 16:02                     ` Martin Krischik
2005-08-21 16:48                       ` Frank J. Lhota
2005-08-22 15:51                         ` Martin Krischik
2005-08-23  0:32                       ` Larry Elmore
     [not found]                         ` <h5dlg1tsie8n3ikirvbi508t9afobhctkj@4ax.com>
2005-08-23 18:09                           ` Martin Krischik
2005-08-23 19:50                             ` C history Björn Persson
2005-08-27 21:09                             ` Dave Thompson [this message]
2005-08-24  1:07                           ` Ada exception block does NOT work? Larry Elmore
2005-08-24  2:36                             ` Jeffrey R. Carter
2005-08-25  0:14                               ` Larry Elmore
2005-08-26  2:44                                 ` Jeffrey R. Carter
2005-08-24 16:44                             ` Martin Krischik
2005-08-22  8:12                     ` Hyman Rosen
2005-08-18 21:15             ` Robert A Duff
2005-08-19 12:00               ` Dmitry A. Kazakov
2005-08-17 20:24 ` Simon Wright
2005-08-18 19:36   ` Björn Persson
2005-08-18 21:07     ` Simon Wright
2005-08-22 10:47 ` bubble
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox