[TUHS] Happy birthday, Dennis Ritchie! [ really sun vs dec/apollo --> X and NeWS ]

Clem Cole clemc at ccc.com
Wed Sep 20 00:32:20 AEST 2017


On Mon, Sep 18, 2017 at 10:50 PM, Larry McVoy <lm at mcvoy.com> wrote:

> So in the BitKeeper source, perror is redifined to my_perror which is
> this:
>
> void
> my_perror(char *file, int line, char *msg)
> {
>         char    *p = 0;
>         int     save = errno;
>
>         if (p = getenv("_BK_VERSION")) {
>                 if (strneq(p, "bk-", 3)) p += 3;
>                 fprintf(stderr, "%s:%d (%s): ", file, line, p);
>         } else {
>                 fprintf(stderr, "%s:%d: ", file, line);
>         }
>         if (p = strerror(errno)) {
>                 fprintf(stderr, "%s: %s\n", msg, p);
>         } else {
>                 fprintf(stderr, "%s: errno=%d\n", msg, errno);
>         }
>         errno = save;
> }
>
> libc should do that.


​+1,  indeed!​ - knowing where the the error came from (file and line) is
huge. Yeah it means putting it in the preprocessor, which has some issues;
but it comes back to a previous comment I have made -- I really believe a
serious production language needs a preprocessor that is carefully used
because there are places (like this one) that just makes the right things
happen.

Clem
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20170919/32420dee/attachment.html>


More information about the TUHS mailing list