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=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FROM,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 19341 invoked from network); 16 May 2020 00:43:58 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 16 May 2020 00:43:58 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id B78E79C6A6; Sat, 16 May 2020 10:43:55 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id B48CD9C668; Sat, 16 May 2020 10:43:37 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="RxUux2vM"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 265089C668; Sat, 16 May 2020 10:43:36 +1000 (AEST) Received: from mail-vs1-f51.google.com (mail-vs1-f51.google.com [209.85.217.51]) by minnie.tuhs.org (Postfix) with ESMTPS id 887AB9C62E for ; Sat, 16 May 2020 10:43:35 +1000 (AEST) Received: by mail-vs1-f51.google.com with SMTP id b11so2315419vsa.13 for ; Fri, 15 May 2020 17:43:35 -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=jsqvYQRn2GhdvZa9CDMp3T3BP+WiqWCOYPb894il6ZI=; b=RxUux2vMyiHSpZYRNyitvx0ZL0bV4HD94pH8U7y8ms3Kgy5YxxCPgPkloQZ84kD9jB MQRjc9/ShgshyBMqCgoPMJaCNLGPO7vCUFc4XN6WFjgrGTyTATP27YNsn96VV3zyG7AL G4t2FK9fo51cK8nkAPkvaKyb+T8nK+y/Yd+/xlLnAxL8QQBCV96xOVlMAeztBqiWFDF9 9fv0026/bSqgdGkO+JFxmd4nLBaXAY9Q4mt7IkhN389YvALrTzfiwazKVNV1FRfxG6q0 A+F3dT90JIH8YAX2+UrqgTDspZ9KF3hCoa2vSiraGdHIwMcWK1eZJcH2WBVNDfBJp8zF xnXA== 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=jsqvYQRn2GhdvZa9CDMp3T3BP+WiqWCOYPb894il6ZI=; b=rQm/wOejX9qdowuckxU51hvqlbI5ycnsXldY415Aa3Py1E4FmpAJq2G6QiHJPP+RjT ZVrTjbf4JzHuB/oUYWPgM2bRopaJgkMtWGeiH1OoVSiEPmw+T05OMWlfIbivsYgh2kE9 x/4SytrQ4oujd0f4Dib9Zz2+JLSXf6Sr/hxlKwndDmrs7eqQD1NmJjSzMGQww0vaaQcK LUZ3dKg4F/3vQnHfTiwgGSYVrgs/Qqq6r1lqcXfo7LTOf3e3zPXir+CSuj4rW1ZLeeGS OOrdTfjhfIGvZPDptaW1KQkIkD0x6uGjH1eG19UmEVkSzJUjoAyQiyF5OoQOxNg5x3H+ yEcg== X-Gm-Message-State: AOAM5302NsroFsFJ+ID7jI3MssYp3FHkq5W8/arVcQJYnsz79pLP2Wab 6GqvUmQaXiwnBwHwl8kd64a7bh0ay7g4yhn2ugU= X-Google-Smtp-Source: ABdhPJwcfUpLEiqoyB7P2EcDMLVEWDAGhV5Z0lWLTIxf/Aw0xNmwEQaaBRWbkL9vbUEix2SwYbgg2j9G17RWgCQpwHs= X-Received: by 2002:a67:f64a:: with SMTP id u10mr4724530vso.202.1589589814583; Fri, 15 May 2020 17:43:34 -0700 (PDT) MIME-Version: 1.0 References: <202005141841.04EIfvEZ063529@tahoe.cs.Dartmouth.EDU> <20200515150122.GF30160@mcvoy.com> <014001d62af3$9cc209b0$d6461d10$@ronnatalie.com> In-Reply-To: <014001d62af3$9cc209b0$d6461d10$@ronnatalie.com> From: "John P. Linderman" Date: Fri, 15 May 2020 20:43:22 -0400 Message-ID: To: Ron Natalie Content-Type: multipart/alternative; boundary="0000000000003ca74e05a5b938df" 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 Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" --0000000000003ca74e05a5b938df Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable If I had been thick enough to declare c as an unsigned char, it would have taken a good bit more than 50% of the time, and wouldn't have worked at all= . On Fri, May 15, 2020 at 4:02 PM wrote: > Unfortunately, if c is char on a machine with unsigned chars, or it=E2=80= =99s of > type unsigned char, the EOF will never be detected. > > > > > > > > > - while ((c =3D getchar()) !=3D EOF) if (c =3D=3D '\n') { /* entire re= cord is > now there */ > > > --0000000000003ca74e05a5b938df Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
If = I had been thick enough to declare c as an unsigned char, it would have tak= en a good bit more than 50% of the time, and wouldn't have worked at al= l.

On Fri, May 15, 2020 at 4:02 PM <ron@ronnatalie.com> wrote:

Unfortunately, if c is cha= r on a machine with unsigned chars, or it=E2=80=99s of type unsigned char, = the EOF will never be detected.

= =C2=A0

=C2=A0

=C2=A0

  • while ((c =3D getchar()) !=3D EOF) if (c =3D=3D '\n') { /* e= ntire record is now there */

=C2=A0

--0000000000003ca74e05a5b938df--