public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: John Reiser <jreiser@bitwagon.com>
To: binutils@sourceware.org
Subject: Re: gold patch committed: Check IOV_MAX
Date: Wed, 09 Mar 2011 16:12:00 -0000	[thread overview]
Message-ID: <4D77A6A7.4060906@bitwagon.com> (raw)
In-Reply-To: <mcr4o7cpasl.fsf@google.com>

Ian Lance Taylor wrote:
> Andreas Schwab <schwab@redhat.com> writes:
> 
>> Ian Lance Taylor <iant@google.com> 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.

-- 

  reply	other threads:[~2011-03-09 16:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-09  1:55 Ian Lance Taylor
2011-03-09  9:37 ` Andreas Schwab
2011-03-09 15:35   ` Ian Lance Taylor
2011-03-09 16:12     ` John Reiser [this message]
2011-03-09 16:20       ` Ian Lance Taylor
2011-03-09 16:15     ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D77A6A7.4060906@bitwagon.com \
    --to=jreiser@bitwagon.com \
    --cc=binutils@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).