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,HTML_MESSAGE,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 1307 invoked from network); 20 Sep 2020 23:53:59 -0000 Received: from minnie.tuhs.org (45.79.103.53) by inbox.vuxu.org with ESMTPUTF8; 20 Sep 2020 23:53:59 -0000 Received: by minnie.tuhs.org (Postfix, from userid 112) id 6195D9CB82; Mon, 21 Sep 2020 09:53:57 +1000 (AEST) Received: from minnie.tuhs.org (localhost [127.0.0.1]) by minnie.tuhs.org (Postfix) with ESMTP id 325E5944A0; Mon, 21 Sep 2020 09:53:18 +1000 (AEST) Authentication-Results: minnie.tuhs.org; dkim=pass (1024-bit key; unprotected) header.d=ccc.com header.i=@ccc.com header.b="A8PB4kj+"; dkim-atps=neutral Received: by minnie.tuhs.org (Postfix, from userid 112) id 27EC194483; Mon, 21 Sep 2020 09:53:16 +1000 (AEST) Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) by minnie.tuhs.org (Postfix) with ESMTPS id 46102940FD for ; Mon, 21 Sep 2020 09:53:15 +1000 (AEST) Received: by mail-qt1-f181.google.com with SMTP id 19so10866203qtp.1 for ; Sun, 20 Sep 2020 16:53:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ccc.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4285aZgVhvUVK+iwEHw/woBInilQZmZOwEWAicdq5BM=; b=A8PB4kj+8bQFL9N1s4wIN9nzy8u/1GVrZYFanX0+ZpWULurSqudHrUMzSclDc1k31Z k9wpzgPqJhkBTgIV/rbCYQWAwPju1boctTtQNoD4cRlIkx2iUfvsFqjnd1SElGpzzxIr SgFQlKz5TAcva4uhMSXkGC2AokdxpB/pXpWQo= 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=4285aZgVhvUVK+iwEHw/woBInilQZmZOwEWAicdq5BM=; b=QXwbPv3RVi3p1fqBm4bzYikDQoXkbTPLUoQMbJflnlMsKwaRqKhFbtv0IY4Wr3MRmg YEIOXnF5xfNiFazRhaid/Znej7eTgzWZWh9jsMUqI+GGEaD2/3yFjvo0NPjyH0a9RcUr iypSwepDdQsPpBnn/4Iw1EtR3GngmaNGznmZ6nPMv+jAmhWybROJjQSskC6vbrwjNhcQ Vrr9z0gvEpREdlRepf7NR4aUBN10vXctnHTKggpJ5CzcnQWdCUEnw2rujPYjJEetDwLv La7kFJb1qeeizSNvjl3Gc1U/3x6wcrbuk/fKaLwgDQ0pAgbSyZgLluiW0zQ6ptlzDOgu 2eFw== X-Gm-Message-State: AOAM532tXSJjWYDyug4up8VDp6fMiMcaKWdUepYi9heI/AhcfxYCBXgu /a2DXTY3ULAjwyD8VFT/jEggic895bRBf1PKu700mIw3ab0= X-Google-Smtp-Source: ABdhPJx4TVkCZ5q9sQsxCv8xwKZSHTRN/K9wqL36MF/lY5J/rmDQ1mzvcsxrzXjF3pTAeqQw+TxOya85VMXsp8lxOiM= X-Received: by 2002:ac8:290c:: with SMTP id y12mr23851414qty.253.1600645994006; Sun, 20 Sep 2020 16:53:14 -0700 (PDT) MIME-Version: 1.0 References: <20200920230057.C5D1A4422E@lignose.oclsc.org> In-Reply-To: <20200920230057.C5D1A4422E@lignose.oclsc.org> From: Clem Cole Date: Sun, 20 Sep 2020 19:53:02 -0400 Message-ID: To: Norman Wilson Content-Type: multipart/alternative; boundary="000000000000e2620305afc76fc3" 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: tuhs@tuhs.org Errors-To: tuhs-bounces@minnie.tuhs.org Sender: "TUHS" --000000000000e2620305afc76fc3 Content-Type: text/plain; charset="UTF-8" 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 understood him but I note NULL was introduced in Typesetter C /V7 where those compiler 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 = NULL; > > But this is. > > char *s = 0; > > > > Clem Cole: > > > > 67)The macro NULL is defined in (and other headers) as a null > > pointer constant; see 7.19. > > > > ==== > > > > $ cat null.c > > char *s = NULL; > > $ cat zero.c > > char *s = 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 = malloc(SIZE)) == NULL) > > error("dammit andrew"); > > though I am willing to omit it when there's no confusion > > about = vs ==: > > 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 --000000000000e2620305afc76fc3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
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 compile NULL with= out a definition which I agree it not legal.=C2=A0 If that is what Doug was= implying I missed understood him but I note NULL was introduced in Typeset= ter C /V7 where those compiler s set it to 0 in studio but the ANSI/ISO mov= ed 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 mor= e 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 N= ULL;

$ cat zero.c

char *s =3D 0;

$



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

files exa= ctly as shown and compile them if you don't

believe me.

<= br>
Prepend `#include <stddef.h>' (or <stdlib.h> or <= stdio.h>)

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

point: you need an include file.



Personall= y I prefer to use NULL instead 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 error("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 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 a= ppropriate standard header file.



Norman Wilson

Toront= o ON (not 0N nor NULLN)

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