The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
* [TUHS] Future Languages
@ 2017-09-05 14:41 Richard Tobin
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Tobin @ 2017-09-05 14:41 UTC (permalink / raw)


> So we have some source (that you can have as well, Apache license)
> that handles not strings but vectors of strings (or structs or whatever).
> 
> I need to write up how it works, it's sort of clever.  It stores both
> the size of the vector (always a power of 2) in part of the bits of the
> first entry and the actual length in the other part.  Because we can
> express powers of two in very little space we can support both values
> in a 32 bit unsigned with a max length of used space of around 134M.

I have something similar.  It allocates space for two ints (number
allocated and used) at ((int *)array)[-1] and [-2].

Typical use is

    LTVectorAndInit(char *, names);

    while(...)
      LTVectorPush(names, s);

    for(i=0; i<LTVectorCount(names); i++)
      ... names[i] ...;

    LTVectorFree(names);

-- Richard

-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



^ permalink raw reply	[flat|nested] 4+ messages in thread
* [TUHS] Why Pascal is Not My Favorite Programming Language - Unearthed!
@ 2017-09-03 14:48 Norman Wilson
  2017-09-04 21:28 ` [TUHS] Future Languages Steve Johnson
  0 siblings, 1 reply; 4+ messages in thread
From: Norman Wilson @ 2017-09-03 14:48 UTC (permalink / raw)


Steve Johnson:

  I think of Alan Demer's comment: "There are two kinds of programming
  languages, those that make it easy to write good programs, and those
  that make it hard to write bad ones."

====

I'm (still) with Larry Flon on this one:

  There does not now, nor will there ever, exist a programming language
  in which it is the least bit hard to write bad programs.

-- SIGPLAN Notices, October 1975, p. 16.

There are certainly language that make it easier to avoid
trivial mistakes, like buffer overruns and pointer botches,
but the sort of nonsense Kernigan and Plaugher demonstrated
and discussed about the same time in The Elements of Programming
Style shows up in any language.

I'm afraid I see that nearly any time I look in source code.
To be fair, these days I rarely have the time to look at
someone else's source code unless it's buggy, but it is
nevertheless appalling what one finds in critical system
software like boot environments and authentication code.

There is no royal language to good programs.  Programming
well takes discipline and skill and experience.  Languages
like Pascal that prevent certain classes of sloppiness like
overrunning arrays and string buffers may be better for
teaching beginners, but only because that makes it easier
to focus on the real issues, such as how to structure a
program well and how to write clearly.  I have yet to see
evidence that that actually happens.

Norman Wilson
Toronto ON


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-05 14:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-05 14:41 [TUHS] Future Languages Richard Tobin
  -- strict thread matches above, loose matches on Subject: below --
2017-09-03 14:48 [TUHS] Why Pascal is Not My Favorite Programming Language - Unearthed! Norman Wilson
2017-09-04 21:28 ` [TUHS] Future Languages Steve Johnson
2017-09-04 21:59   ` Larry McVoy
2017-09-05  2:21   ` Noel Hunt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).