This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gold patch committed: Check IOV_MAX


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.

-- 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]