list terminator for execl -- NULL vs 0 etc.
Henry Spencer
henry at utzoo.UUCP
Sat Jan 28 08:53:35 AEST 1984
The problem with execl is that the manual page retains a nontrivial
machine-dependency, and this is what Mark is running into. There
is *no* general way to fix this problem while retaining the convention
that the terminator is just plain "0", at least none that doesn't cause
worse problems somewhere else.
The only way to fix this properly is to say that the list terminator
for execl is "(char *) 0" (or equivalently "(char *)NULL"), not just
"0" or "NULL". Remember that this is a C function call, and the things
you pass do not have the right type unless you make sure of it yourself.
The explicit cast is necessary, because there are machines which have
different representations for "int *" and "char *"; on such machines
there is *no* way to define NULL that will cover both automatically.
Hence one cannot rely on NULL to do the job at all.
--
Henry Spencer @ U of Toronto Zoology
{allegra,ihnp4,linus,decvax}!utzoo!henry
More information about the Comp.unix.wizards
mailing list