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_INVALID,DKIM_SIGNED, HTML_MESSAGE,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 17646 invoked from network); 21 Sep 2020 02:25:24 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 21 Sep 2020 02:25:24 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id 4E3819CB81; Mon, 21 Sep 2020 12:25:16 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id BA2DA940FD; Mon, 21 Sep 2020 12:24:34 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=ccil-org.20150623.gappssmtp.com header.i=@ccil-org.20150623.gappssmtp.com header.b="C5n141MH"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 8D481940FD; Mon, 21 Sep 2020 12:24:30 +1000 (AEST) Received: from mail-qk1-f169.google.com (mail-qk1-f169.google.com [209.85.222.169]) by minnie.tuhs.org (Postfix) with ESMTPS id 2769893F5B for ; Mon, 21 Sep 2020 12:24:29 +1000 (AEST) Received: by mail-qk1-f169.google.com with SMTP id c62so343240qke.1 for ; Sun, 20 Sep 2020 19:24:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ccil-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ttZtgi+nIpI2jPSnQSB5j14FiWx+yqGPInW8mfgP6VY=; b=C5n141MHxum56tNEhagZ7mnPU5S46EmNqbajAMkyxikKKsu/hNspDSA+omxe7BTmSk Kx9o3+3pgAN4X0C0dQneg0EJgx6bHCfhtVaGH/bVKy+X3bGj0+k5F1wY3SwFGlIXndIx D+U+mKFYaCm9DjuIx+13YFyRLPicAnRSe3uMZEHv2nWEjy+TP9tJlqb1qFYAET5YclSv 6oW8ycLno66NAmMINhQeOpuQO5JPCuXg7dLN7WnkQZNFhEUgyM2mtazU1b1ZQn7lQmH6 WQAdUX5JEbnA6nSWs69Y4T/edeayjJWU7K7PT+m5ROGanuPZtjRM+3qV4roOZiRnSCu+ kdpQ== 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=ttZtgi+nIpI2jPSnQSB5j14FiWx+yqGPInW8mfgP6VY=; b=GsubtPnOl/XnWE7v0Wa3bvXBZv/Wx7iiJCh1ioqFTEdKkIkRzW67f1U4Hkaim0IWnU p48hSx/ekHosNXLaHos1PPD8y7nyy9sKvsFHDELFeS0wovKhk4Cz0eKIoomFAqEXvnxT ARPklL1h6KHSERKI6B2Zngm5j6fW5xeWM8x/+iy/6Kxzl55JsLL/1kHW0vDnsrRCl2tU cEeZEPDSrVdyyWHIHEVMBOAuFRg8/PcL3aehxlpK0wQl9L/9KJY692xbC/oqMpOgEcw4 I1PHLdAEwcfOQPXxJ+09ZShx6k37+oj4JgN6oixl9onPyASin+rg1K+qW0JVKzXxqvGT cYSA== X-Gm-Message-State: AOAM532qAQf8a7+sGhfWMIcfw2XcCaKTHmq9MqOsdLMITxuwWIkQARJj VtbPRWRh02qrAYRc/3walN/KsMXak2sKOdnzUQWGNv6LjmucglO/ X-Google-Smtp-Source: ABdhPJxJ88Ne5nPWl4kvniRBIo61eJ3vWe+6EupTu55DJR5/qHABxun56LVvXi1Mvxtjeq7mMquygP52cjQ96FZ9qCI= X-Received: by 2002:a05:620a:1274:: with SMTP id b20mr43585593qkl.358.1600655068171; Sun, 20 Sep 2020 19:24:28 -0700 (PDT) MIME-Version: 1.0 References: <20200920230057.C5D1A4422E@lignose.oclsc.org> In-Reply-To: From: John Cowan Date: Sun, 20 Sep 2020 22:24:17 -0400 Message-ID: To: Clem Cole Content-Type: multipart/alternative; boundary="000000000000bf25ce05afc98c5b" Subject: Re: [TUHS] reviving a bit of WWB 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" --000000000000bf25ce05afc98c5b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable ISO requires that NULL be defined in locale.h, stddef.h, stdio.h, stdlib.h, string.h, time.h, wchar.h, and their C++ equivalents clocale etc.. It's pretty unlikely that you can write any useful code at all without NULL being defined as a side effect. On Sun, Sep 20, 2020 at 8:01 PM Clem Cole wrote: > I was also stating (under Henry=E2=80=99s 10th) using a properly defined = macro > with the complete cast scheme will be correct and portable to all known > conforming C compilers no matter the target HW architecture =E2=80=94 whi= ch in a > commercial SW setting is highly valued. > > Clem > > On Sun, Sep 20, 2020 at 7:53 PM Clem Cole wrote: > >> Norman NULL has to be defined and I said that/showed it. The standard >> says where. I was not trying to compile NULL without a definition which= I >> agree it not legal. If that is what Doug was implying I missed understo= od >> him but I note NULL was introduced in Typesetter C /V7 where those compi= ler >> s set it to 0 in studio but the ANSI/ISO moved it. >> >> On Sun, Sep 20, 2020 at 7:03 PM Norman Wilson wrote: >> >>> Doug McIlroy: >>> >>> >>> >>> To put it more strongly. this is not a legal C source file. >>> >>> char *s =3D NULL; >>> >>> But this is. >>> >>> char *s =3D 0; >>> >>> >>> >>> Clem Cole: >>> >>> >>> >>> 67)The macro NULL is defined in (and other headers) as a >>> null >>> >>> pointer constant; see 7.19. >>> >>> >>> >>> =3D=3D=3D=3D >>> >>> >>> >>> $ cat null.c >>> >>> char *s =3D NULL; >>> >>> $ cat zero.c >>> >>> char *s =3D 0; >>> >>> $ >>> >>> >>> >>> zero.c is a legal C program. null.c is not. Create >>> >>> files exactly as shown and compile them if you don't >>> >>> believe me. >>> >>> >>> >>> Prepend `#include ' (or or ) >>> >>> to null.c and it becomes legal, but I think that's Doug's >>> >>> point: you need an include file. >>> >>> >>> >>> Personally I prefer to use NULL instead of 0 when spelling >>> >>> out a null pointer, because I think it's clearer: >>> >>> if ((buf =3D malloc(SIZE)) =3D=3D NULL) >>> >>> error("dammit andrew"); >>> >>> though I am willing to omit it when there's no confusion >>> >>> about =3D vs =3D=3D: >>> >>> if (*p) >>> >>> dammit(*p, "andrew"); >>> >>> >>> >>> But that's just a question of style, and Doug's is fine too. >>> >>> >>> >>> The language does not require the compiler to pre-define >>> >>> NULL or to recognize it as a keyword; you have to include >>> >>> an appropriate standard header file. >>> >>> >>> >>> Norman Wilson >>> >>> Toronto ON (not 0N nor NULLN) >>> >>> -- >> Sent from a handheld expect more typos than usual >> >> >> -- > Sent from a handheld expect more typos than usual > --000000000000bf25ce05afc98c5b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
ISO requires that NULL be defined in=C2=A0locale.h, stddef= .h, stdio.h, stdlib.h, string.h, time.h, wchar.h, and their C++ equivalents= clocale etc..=C2=A0 It's pretty unlikely that you can write any useful= code at all without NULL being defined as a side effect.



Norman NULL has to be defined and I said that/= showed it. =C2=A0 The standard says where.=C2=A0 I was not trying to compil= e NULL without a definition which I agree it not legal.=C2=A0 If that is wh= at Doug was implying I missed understood him but I note NULL was introduced= in Typesetter C /V7 where those compiler s set it to 0 in studio but the A= NSI/ISO moved it.=C2=A0

On Sun, Sep 20, 2020 at 7:03 PM Norman Wilson= <norman@oclsc.org= > wrote:
= Doug McIlroy:



=C2=A0 To put it more strongly. this is not a = legal C source file.

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 char *s =3D = NULL;

=C2=A0 But this is.

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = char *s =3D 0;



Clem Cole:



=C2=A0 =C2=A067)The= macro NULL is defined in <stddef.h> (and other headers) as a null
=C2=A0 =C2=A0pointer constant; see 7.19.



=3D=3D=3D=3D


$ cat null.c

char *s =3D NULL;

$ cat zero.c
=
char *s =3D 0;

$



zero.c is a legal C program.=C2= =A0 null.c is not.=C2=A0 Create

files exactly as shown and compile t= hem if you don't

believe me.



Prepend `#include &l= t;stddef.h>' (or <stdlib.h> or <stdio.h>)

to null= .c and it becomes legal, but I think that's Doug's

point: yo= u need an include file.



Personally I prefer to use NULL inst= ead of 0 when spelling

out a null pointer, because I think it's = clearer:

=C2=A0 =C2=A0 =C2=A0 =C2=A0 if ((buf =3D malloc(SIZE)) =3D= =3D NULL)

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 er= ror("dammit andrew");

though I am willing to omit it when = there's no confusion

about =3D vs =3D=3D:

=C2=A0 =C2=A0 = =C2=A0 =C2=A0 if (*p)

=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 dammit(*p, "andrew");



But that's ju= st a question of style, and Doug's is fine too.



The lang= uage does not require the compiler to pre-define

NULL or to recogniz= e it as a keyword; you have to include

an appropriate standard heade= r file.



Norman Wilson

Toronto ON (not 0N nor NULLN)
--
Sent from a handheld= expect more typos than usual


--
=
Sent from a handheld expect more typos than usual
--000000000000bf25ce05afc98c5b--