From owner-svn-src-head@freebsd.org Wed Jun 13 10:03:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F236E101B705; Wed, 13 Jun 2018 10:03:24 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail110.syd.optusnet.com.au (mail110.syd.optusnet.com.au [211.29.132.97]) by mx1.freebsd.org (Postfix) with ESMTP id C2E7D78B9E; Wed, 13 Jun 2018 10:03:23 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail110.syd.optusnet.com.au (Postfix) with ESMTPS id 977671062BC; Wed, 13 Jun 2018 20:03:14 +1000 (AEST) Date: Wed, 13 Jun 2018 20:03:13 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Eitan Adler cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r335041 - head/lib/libc/stdlib In-Reply-To: <201806130852.w5D8qH9a093758@repo.freebsd.org> Message-ID: <20180613194008.W2003@besplex.bde.org> References: <201806130852.w5D8qH9a093758@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=cIaQihWN c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=bJuSaEbL97EEYz8fo-IA:9 a=CjuIK1q_8ugA:10 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Jun 2018 10:03:25 -0000 On Wed, 13 Jun 2018, Eitan Adler wrote: > Log: > libc: remove explicit cast NULL in atoi > > There isn't any reason to cast NULL so just remove it. Noticed when > cleaning up top. There are many reasons to cast NULL for all members of the ato*() family: - it is required if no prototype is in scope - C99 specifies ato*() in terms of strtol*() and uses the cast to NULL, probably because this is simplest. Omitting the cast is just wrong if no prototype is in scope. Writing the explicit cast is simpler than writing caveats that the stated equivalence is only valid if a prototype is in scope. - POSIX specifies ato*() in terms of strtol*() and uses the cast to NULL, exactly as in C99, probably because it defers to the C standard and doesn't and doesn't risk breaking it by changing its wording except when extending it. FreeBSD used to do the same here, and should do the same here and elsewhere by copying better wording from POSIX whenever possible. Bruce