At Sun, 20 Sep 2020 17:35:52 -0400, John Cowan <cowan(a)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 (and of course
with the rather tricky and almost non-portable way C allows variable
length argument lists, along with the somewhat poor way C was cajoled
into offering function prototypes to support separate compilation of
code units and the exceedingly poor way prototypes deal with variable
length argument lists).
--
Greg A. Woods <gwoods(a)acm.org>
Kelowna, BC +1 250 762-7675 RoboHack <woods(a)robohack.ca>
Planix, Inc. <woods(a)planix.com> Avoncote Farms <woods(a)avoncote.ca>