This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: C++ Standard Question
- From: Marc Glisse <marc dot glisse at inria dot fr>
- To: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- Cc: GCC Mailing List <gcc at gcc dot gnu dot org>, libstdc++ at gcc dot gnu dot org
- Date: Thu, 22 Jan 2015 22:44:45 +0100 (CET)
- Subject: Re: C++ Standard Question
- Authentication-results: sourceware.org; auth=none
- References: <54C16C36 dot 7090409 at oarcorp dot com>
- Reply-to: libstdc++ at gcc dot gnu dot org
On Thu, 22 Jan 2015, Joel Sherrill wrote:
I think this is a glibc issue but since this method is defined in the C++
standards, I thought there were plenty of language lawyers here. :)
s/glibc/libstdc++/ and they have their own ML.
<strstream>
That's deprecated, isn't it?
class strstreambuf : public basic_streambuf<char, char_traits<char> >
ISSUE ====> int pcount() const; <===== ISSUE
My reading of the C++03 and draft C++14 says that the int pcount() method
in this class is not const. glibc has it const in the glibc shipped with
Fedora 20
and CentOS 6.
This is a simple test case:
#include <strstream>
int main() {
int (std::strstreambuf::*dummy)() = &std::strstreambuf::pcount;
/*-- pcount is conformant --*/
return 0;
}
What's the consensus?
The exact signature of member functions is not mandated by the standard,
implementations are allowed to make the function const if that works (or
provide both a const and a non-const version). Your code is not guaranteed
to work. Lambdas usually provide a fine workaround.
--
Marc Glisse