Re: [Boost-bugs] [Boost C++ Libraries] #6160: support for (istream >> array < char >)

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #6160: support for (istream >> array < char >)
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2011-11-28 16:43:57

#6160: support for (istream >> array < char >)
  Reporter: giecrilj@… | Owner: marshall
      Type: Feature Requests | Status: assigned
 Milestone: To Be Determined | Component: array
   Version: Boost 1.44.0 | Severity: Cosmetic
Resolution: | Keywords:

Comment (by ne01026@…):

 Replying to [comment:6 marshall]:
> Replying to [comment:4 ne01026@…]:
> > `char []` has unknown length, `array < char >` has known length,
 therefore `>> array` is safer than `>> char []`, and my code, attached,
 q.v., uses this information to prevent buffer overflow.
> `char []` has known length - sizeof is your friend here.

 `sizeof (char [])` is undefined.

> I see where your code is using the length to prevent a buffer overflow -
 but doing that at every stream extraction is error-prone, at best. It
 seems to me that (famous last words) that if this were to be implemented,
 it should never overflow the bounds of the array.

 The extraction operator will not extract more characters than the array
 length, minus one, so where is the error?

> Do you know if this was considered for std::array?

 I do not know; however, given that std takes from boost and not the other
 way round, I decided to put it here first. At least, the thing seems
 obvious and straighforward to me. The standard library has special
 semantics for (native) character arrays, and so should we.

 I tried to discuss the matter at #boost and I was told to file an
 enhancement, so here it is.

Ticket URL: <>
Boost C++ Libraries <>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:07 UTC