[TUHS] Comments on "C"

John Cowan cowan at ccil.org
Thu Sep 1 00:37:03 AEST 2016


On Wed, Aug 31, 2016 at 9:32 AM, Ron Natalie <ron at ronnatalie.com> wrote:

> The null pointer constant does not need a cast on ANY architecture .


Well, it's a matter of what counts as "need".  People normally expect
execl("/bin/sh", "sh", "-c", "date", NULL) to work, but it will not on
systems
that define NULL as 0 and have different sizes of integers and pointers
(or, Ghu forbid, null pointers that are not all-bits-0).  The man page is
careful to warn against this practice, but it is commonplace anyhow,
and on such architectures, defining NULL as (void *)0 will protect
users against this situation.

-- 
John Cowan          http://www.ccil.org/~cowan        cowan at ccil.org
Clear?  Huh!  Why a four-year-old child could understand this report.
Run out and find me a four-year-old child.  I can't make head or tail
out of it.        --Rufus T. Firefly on government reports
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20160831/0de71090/attachment.html>


More information about the TUHS mailing list