From owner-svn-src-head@FreeBSD.ORG Mon Nov 19 19:36:19 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C5AD5C2E; Mon, 19 Nov 2012 19:36:19 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail02.syd.optusnet.com.au (mail02.syd.optusnet.com.au [211.29.132.183]) by mx1.freebsd.org (Postfix) with ESMTP id 3BB038FC0C; Mon, 19 Nov 2012 19:36:18 +0000 (UTC) Received: from c122-106-175-26.carlnfd1.nsw.optusnet.com.au (c122-106-175-26.carlnfd1.nsw.optusnet.com.au [122.106.175.26]) by mail02.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id qAJJa9kM027334 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 20 Nov 2012 06:36:11 +1100 Date: Tue, 20 Nov 2012 06:36:09 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Rui Paulo Subject: Re: svn commit: r243262 - head/usr.bin/top In-Reply-To: <3241E07C-D177-4297-825A-A52FEA8F1241@FreeBSD.org> Message-ID: <20121120063319.H3656@besplex.bde.org> References: <201211190803.qAJ83eRo014127@svn.freebsd.org> <20121119082618.GB67020@FreeBSD.org> <3241E07C-D177-4297-825A-A52FEA8F1241@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-Cloudmark-Score: 0 X-Optus-Cloudmark-Analysis: v=2.0 cv=XbrRV/F5 c=1 sm=1 a=FLvZyyl_zxUA:10 a=kj9zAlcOel0A:10 a=PO7r1zJSAAAA:8 a=JzwRw_2MAAAA:8 a=6Djc_KAXMDkA:10 a=6I5d2MoRAAAA:8 a=6Q3wHs0oV5EYVVmnQq0A:9 a=CjuIK1q_8ugA:10 a=SV7veod9ZcQA:10 a=bxQHXO5Py4tHmhUgaywp5w==:117 Cc: svn-src-head@freebsd.org, Alexey Dokuchaev , src-committers@freebsd.org, svn-src-all@freebsd.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 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: Mon, 19 Nov 2012 19:36:19 -0000 On Mon, 19 Nov 2012, Rui Paulo wrote: > On 19 Nov 2012, at 00:26, Alexey Dokuchaev wrote: > >> On Mon, Nov 19, 2012 at 08:03:40AM +0000, Rui Paulo wrote: >>> New Revision: 243262 >>> URL: http://svnweb.freebsd.org/changeset/base/243262 >>> >>> - cmdbuf = (char *)malloc(cmdlengthdelta + 1); >>> + cmdbuf = (char *)malloc(cmdlen + 1); >> >> Why explicitly casting malloc return() value (void *)? > > Why are you asking me about code I didn't write? :-) > I don't want to mix style changes with functional changes so I let it be. If you're asking why our source tree has malloc casts, it's because compilers in the 1980s used to be unnecessarily more pedantic. It is more because code written in the 1980's didn't even declare malloc(). It tried to hide its bug by casting malloc(). The behaviour was still undefined. Now, C++ compilers are more strict. Bruce