From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30110 invoked by alias); 9 Mar 2011 16:20:19 -0000 Received: (qmail 30092 invoked by uid 22791); 9 Mar 2011 16:20:17 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (216.239.44.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 09 Mar 2011 16:20:12 +0000 Received: from kpbe20.cbf.corp.google.com (kpbe20.cbf.corp.google.com [172.25.105.84]) by smtp-out.google.com with ESMTP id p29GKAHf016213 for ; Wed, 9 Mar 2011 08:20:10 -0800 Received: from gwaa18 (gwaa18.prod.google.com [10.200.27.18]) by kpbe20.cbf.corp.google.com with ESMTP id p29GJF3k008954 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Wed, 9 Mar 2011 08:20:09 -0800 Received: by gwaa18 with SMTP id a18so81106gwa.5 for ; Wed, 09 Mar 2011 08:20:09 -0800 (PST) Received: by 10.150.193.17 with SMTP id q17mr7842710ybf.189.1299687608918; Wed, 09 Mar 2011 08:20:08 -0800 (PST) Received: from coign.google.com (dhcp-172-22-123-197.mtv.corp.google.com [172.22.123.197]) by mx.google.com with ESMTPS id p29sm1558866ybk.1.2011.03.09.08.20.08 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 09 Mar 2011 08:20:08 -0800 (PST) From: Ian Lance Taylor To: John Reiser Cc: binutils@sourceware.org Subject: Re: gold patch committed: Check IOV_MAX References: <4D77A6A7.4060906@bitwagon.com> Date: Wed, 09 Mar 2011 16:20:00 -0000 In-Reply-To: <4D77A6A7.4060906@bitwagon.com> (John Reiser's message of "Wed, 09 Mar 2011 08:11:19 -0800") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-03/txt/msg00186.txt.bz2 John Reiser writes: > Ian Lance Taylor wrote: >> Andreas Schwab writes: >> >>> Ian Lance Taylor writes: > >>>> void >>>> File_read::read_multiple(off_t base, const Read_multiple& rm) >>>> { >>>> + static size_t iov_max = GOLD_IOV_MAX; >>> >>> const? >> >> I've written the code this way because IOV_MAX need not be a constant. >> It may be a call to sysconf. > > static size_t const iov_max = GOLD_IOV_MAX; > > That use of 'const' denotes a property of the local variable 'iov_max' > which can be valuable for documentation, maintenance, and optimization. > Nothing is implied regarding the initializing expression 'GOLD_IOV_MAX', > which may be simple or arbitrarily complicated. > > If it is desired to emphasize that the expansion of GOLD_IOV_MAX might > involve more than literal numeric constants, then perhaps an explicit > [and superfluous] cast > > static size_t const iov_max = (size_t const) GOLD_IOV_MAX; > > might be appropriate. Everything you say is true, but I find the code to be clear as it stands and see no reason to change it. Ian