Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Mar 1996 17:21:26 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, wosch@cs.tu-berlin.de
Cc:        current@FreeBSD.org
Subject:   Re: *.mk wishes
Message-ID:  <199603120621.RAA02242@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help

>>newfs/mkfs.c passes an uncast 0 for a pointer and an uncast 0 for an off_t.
>>rpc.statd passes an uncast NULL for a pointer and an uncast 0 for an off_t.
>>I would't worry about fixing this.  There must be a prototype in scope for
>>the uncast 0 for an off_t to work, and it isn't a bug to omit the casts iff
>>there is a prototype in scope.  Just fix the configuration.  Do we have a
>>working mmap? :-)

>http://www.lysator.liu.se/c/ten-commandments.html

>...
>It may be thought that the radical new blessing of ``prototypes''
>might eliminate the need for caution about argument types.  Not so,
>brethren.  Firstly, when confronted with the twisted strangeness of
>variable numbers of arguments, the problem returns... and he who has
>not kept his faith strong by repeated practice shall surely fall to
>this subtle trap.  Secondly, the wise men have observed that reliance
>on prototypes doth open many doors to strange errors, and some indeed
>had hoped that prototypes would be decreed for purposes of error
>checking but would not cause implicit conversions.  Lastly, reliance
>on prototypes causeth great difficulty in the Real World today, when
                                               Unix World yesterday?
                                               Real World last week?
>many cling to the old ways and the old compilers out of desire or
>necessity, and no man knoweth what machine his code may be asked to
>run on tomorrow.

I mostly agree with this, but there are too many uncast NULLs to fix:

$ find /usr/src -type f | xargs grep ', NULL,' | grep -v '[{}]' | wc -l
738
$ find /usr/src/sys -type f | xargs grep ', NULL,' | grep -v '[{}]' | wc -l
106

This finds mostly uncast NULL pointers in function calls, but nowhere near
all of them.

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199603120621.RAA02242>