On Sun, Sep 20, 2020 at 4:58 PM Doug McIlroy <doug@cs.dartmouth.edu> wrote:

To put it more strongly. this is not a legal C source file.
        char *s = NULL;
But this is.
        char *s = 0;

Hmmm ...  Doug - As the risk of playing language lawyer here, I'm going to argue that between sections 6.3.2.3 and 7.19 the first is legal.   Cut/pasted from my cope of the 2017 standard (I don't think this has changed in later drafts):

ISO/IEC 9899:2017 Section 6.3.2.3 Pointers 
....
  1. An integer constant expression with the value 0, or such an expression cast to type void *, is called a null pointer constant.67) If a null pointer constant is converted to a pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal to a pointer to any object or function. 

  2. 67)The macro NULL is defined in <stddef.h> (and other headers) as a null pointer constant; see 7.19. 


....
ISO/IEC 9899:2017 Section 7.19 Common definitions <stddef,h>
.... 
  1. The macros are

    NULL

    which expands to an implementation-defined null pointer constant; 

For whatever its worth, in a number of common coding standards where I have worked, have always required that when NULL was used, it was always cast first to the actual data type.  Yes, this is verbose, but it means that a casual reader sees the type and in particularly in a commerical SW development setting, that is money in the bank from a maintence standpoint --  IIRC Gimpel's flexelint (which IMO oppinion was always the best lint around), has a switch that will force that behavior.  

As I understand it, the idea behind -Wall et al, is that if we can get code to be 'flexelint clean' the number of latent bugs drops dramatically.  This is particularly true when dealing with code that started be written on a system with one word or pointer size and now needs to run elsewhere; which is a common issue commerical ISVs live a great deal [this is a codified in the 10th of Henry's commandments:

Thou shalt foreswear, renounce, and abjure the vile heresy which claimeth that ``All the world's a VAX'', and have no commerce with the benighted heathens who cling to this barbarous belief, that the days of thy program may be long even though the days of thy current machine be short.

: .