[TUHS] reviving a bit of WWB

Larry McVoy lm at mcvoy.com
Wed Feb 3 09:47:03 AEST 2021


On Tue, Feb 02, 2021 at 03:08:42PM -0800, Greg A. Woods wrote:
> At Sun, 20 Sep 2020 17:35:52 -0400, John Cowan <cowan at ccil.org> wrote:
> Subject: Re: [TUHS] reviving a bit of WWB
> >
> > When 0 is coerced implicitly or explicitly to a pointer type, it becomes a
> > null pointer.  That's true even on architectures where all-bits-zero is
> > *not* a null pointer.  However, in contexts where there is no expected
> > type, as in a call to execl(), the null at the end of the args list has to
> > be explicitly cast to (char *)0 or some other null pointer.
> 
> Yeah, that's more to do with the good/bad choice in C to do or not do
> integer promotion in various situations, and to default parameter types
> to 'int' unless they are, or are cast to, a wider type

I've dealt with this, here is a story of a super computer where native
pointers pointed at bits but C pointers pointed at bytes and you can
shake your head at the promotion problems:

https://minnie.tuhs.org/pipermail/tuhs/2017-September/012050.html


More information about the TUHS mailing list