From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 27268 invoked from network); 15 May 2020 15:37:59 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 15 May 2020 15:37:59 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id 180FC9C994; Sat, 16 May 2020 01:37:55 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 52E659C677; Sat, 16 May 2020 01:37:18 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="GRjmHfB+"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 9DA569C677; Sat, 16 May 2020 01:37:10 +1000 (AEST) Received: from mail-ua1-f46.google.com (mail-ua1-f46.google.com [209.85.222.46]) by minnie.tuhs.org (Postfix) with ESMTPS id 3A0BA9C668 for ; Sat, 16 May 2020 01:37:10 +1000 (AEST) Received: by mail-ua1-f46.google.com with SMTP id k4so934423uaq.10 for ; Fri, 15 May 2020 08:37:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+19DLKjhnbpNjfKUvtUKdvxjaOHf9ZSuHLZO7+JdkmU=; b=GRjmHfB+YCe3FxZB18hPFQ1O3wau/7Q0sI0uHvXoRww6r7s1DBoxJFsYxtkaay8KP8 KVIaDfTXUMDS//UJM3Renqh52uf2jwN+/4BzA5ajs804sMEAhnJPe1RfEYvKSV+xtZBJ 7rCoePVaOVhhpRVnsq4PNj+YlnJpWgfuyJsTM75Q8whilg7to2Uj0m2WCQHt/sYebAke jUSqQgqAY2pfAE6Hmsvc88ik4cZ33SQ/ewQALCINksAADwkdVvK9kB/4pimmXK/c0EC5 8cq+MvhhGInynjb1i/0cLVKQQ9OPv7qZu7r/QloJCcQ0+thGcILCwi+8Hiwz2GmUpLvi RXWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+19DLKjhnbpNjfKUvtUKdvxjaOHf9ZSuHLZO7+JdkmU=; b=uRWIXFLzbSDd4tCWUzgaB37v5LQ1x8zK8mpMvj7wZnX3epQStR0/zVZV1cuwg0X067 m7td9mVeNBt5h3NjB8BeGKBtlSktRk9DTM+ZR8ffKynX7JJgQWUMcGc5zTfLWoS9cAgS z9UmfoPVzdgANgfplmUFFTonYVC+tx7euGx5ZV9VP1LjvlblvvaAT+g9zGO/eoRtc74o cLrNrs0DeQwR1L3EqbiwjbmALWvIzLeHCILmBV8dyDCFIK2TUqQQzsuO3w1x1qR7sIxX siqSh/p/fXhpsJikFvWq+BCPKOk4cf4nitR3mpseCZegwqxgdL9JuvbSYRgRItdRUKhk uc/g== X-Gm-Message-State: AOAM5303ar0T1zYSRvKmoPzRs25vHEX8j6EAnwJzKmFGTjJsuq94mcOw ew5dQBDLQARKZuMhn8M7EtHOJGcsm53Dsc54788= X-Google-Smtp-Source: ABdhPJwh/hpF4LtZYEpwsDi75RNBdyOBAN0cIqmNfiOBey9MMHLLcNdW2yjHOhqIA0Zj7GbrY9o49I7r5Ot0+p9m9Yc= X-Received: by 2002:ab0:7298:: with SMTP id w24mr3383726uao.95.1589557028668; Fri, 15 May 2020 08:37:08 -0700 (PDT) MIME-Version: 1.0 References: <202005141841.04EIfvEZ063529@tahoe.cs.Dartmouth.EDU> <20200515150122.GF30160@mcvoy.com> In-Reply-To: <20200515150122.GF30160@mcvoy.com> From: "John P. Linderman" Date: Fri, 15 May 2020 11:36:55 -0400 Message-ID: To: Larry McVoy Content-Type: multipart/alternative; boundary="0000000000000b512505a5b196ff" Subject: Re: [TUHS] v7 K&R C X-BeenThere: tuhs@minnie.tuhs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: The Unix Heritage Society mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: The Eunuchs Hysterical Society , Doug McIlroy Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" --0000000000000b512505a5b196ff Content-Type: text/plain; charset="UTF-8" On Fri, May 15, 2020 at 08:55:46AM +0100, Dr Iain Maoileoin wrote: > My question is: > What is that line? I dont understand it? Effort input vs output? > Complexity measure, debugging complexity in a 3rd party program? I think of it less as a line than as a continuum. I am reminded of an input routine I wrote for a sort several decades ago. Allocate a pointer from one end of memory, start reading a record into the other end of memory with something like while ((c = getchar()) != EOF) if (c == '\n') { /* entire record is now there */ Very easy to understand, no guesswork about allocating pointers versus records, and a complete and utter pig. 50% of the processing time of the entire sort went into loading records. There were 5 or 6 comparisons being done for every *character* of input (I omitted the bit about verifying that there was room to store the next character). It might have made for good reading, but nobody would have used it, because much faster sorts were already available, and most people *use* code, not *read* it. So I had to push into uglier territory to get something that worked well enough to be worth reading. --0000000000000b512505a5b196ff Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Fri, May 15, 2020 at 08= :55:46AM +0100, Dr Iain Maoileoin wrote:
> My question is:
> What is th= at line?=C2=A0 I dont understand it?=C2=A0 Effort input vs output?> Comp= lexity measure,=C2=A0 debugging complexity in a 3rd party program?

I think of it less as a = line than as a continuum. I am reminded of an input routine I wrote for a s= ort several decades ago. Allocate a pointer from one end of memory, start r= eading a record into the other end of memory with something like
while ((c =3D getchar= ()) !=3D EOF) if (c =3D=3D '\n') { /* entire record is now there */=
Very= easy to understand, no guesswork about allocating pointers versus records,= and a complete and utter pig. 50% of the processing time of the entire sor= t went into loading records. There were 5 or 6 comparisons being=C2=A0done = for every character=C2=A0of input (I omitted the bit about verifying= that there was room to store the next character). It might have made for g= ood reading, but nobody would have used it, because much faster sorts were = already available, and most people use code, not read it. So = I had to push into uglier territory to get something that worked well enoug= h to be worth reading.
--0000000000000b512505a5b196ff--