C++ Standard Question
Joel Sherrill
joel.sherrill@oarcorp.com
Thu Jan 22 22:28:00 GMT 2015
On 1/22/2015 3:44 PM, Marc Glisse wrote:
> 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.
Thank you.
>> <strstream>
> That's deprecated, isn't it?
Yes. There is also a warning about that coming from the test code.
I don't know how long it has been deprecated since even with
-std=c++03, the warning is present.
>> 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.
>
This code is actually from the Open Group FACE Conformance Test Suite.
It uses code like this to check the presence of methods from the C Standard
Library, POSIX APIs, and the C++ Standard Library. It would be really
helpful
if you could cite the place in the C++ standard so I can provide that as
feedback
to the authors of the test suite.
On a positive note, the test suite isn't flagging much using this
technique. This
may be the only method. But I would like to provide the correct feedback to
them so no one else deals with this.
Thanks.
--
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the Libstdc++
mailing list