Re: http://www-cs-faculty. stanford.edu/∼uno/programs/tcalc.w.gz

Philip Taylor P.Taylor at Hellenic-Institute.Uk
Sat May 16 18:26:52 CEST 2020


Andreas Scherer wrote:
> Addenda:
>
> Chapter 12 of Don's "Literate Programming" (the book of 1992, not the
> article of 1984 included therein; see
> http://www-cs-faculty.stanford.edu/~knuth/lp.html) has "An Example of
> CWEB (1990)", already co-authored by Silvio Levy and Don Knuth, and
> based on a program by Klaus Guntermann and Joachim Schrod.
>
> The intro to this chapter specifically notes: "CWEB does not require
> special facilities for macro processing and string manipulation, because
> C already provides such features."

Thanks, Andreas — I do indeed have a bound copy of same, sadly not signed by the author (unlike my copy of /3:16/) ...

> Skimming the source code of "The Stanford GraphBase" shows the use of
> 'calloc' for dynamically creating objects at runtime, something that is
> at best awkward to do in Pascal and at worst not portable between Pascal
> dialects.

It is a long time since I wrote any serious Pascal, and somewhat to my embarrasment I can't even see a copy of the /User Manual and Report/ as I write, but I am reasonably sure that standard Pascal supports the 'new' generator which allocates a new variable, 'though whether from stack or heap I no longer remember ...

> Moreover, SGB's 'gb_graph.w' has an "Important Note"
> regarding an assumption about the workings of 'calloc' (see
> http://github.com/ascherer/sgb/blob/master/gb_graph.w#L256).

Just read it :  that is some seriously misguided programming, IMHO !


> > {\sl Important Note:\/}
> > Programs of the Stanford GraphBase implicitly assume that all
> > memory allocated by |calloc| comes from a single underlying memory array.
> > Pointer values are compared to each other in many places, even when
> > the objects pointed to have been allocated at different times. Strictly
> > speaking, this liberal use of pointer comparisons fails to conform to
> > the restrictions of ANSI Standard \CEE/, if the comparison involves
> > a less-than or greater-than relation. Users whose system supports only
> > the strict standard will need to make several dozen changes.
> > @^system dependencies@>

/** Phil./

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texhax/attachments/20200516/d9710fc3/attachment.html>


More information about the texhax mailing list.