[Bug 207918] C++ ostream operator << broken for unsigned long long when using showbase with octal format

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Sat Mar 12 09:02:45 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=207918

Mahdi Mokhtari <mokhi64 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|New                         |In Progress
                 CC|                            |mokhi64 at gmail.com

--- Comment #1 from Mahdi Mokhtari <mokhi64 at gmail.com> ---
I've checked this.
I figured out it happens for all ::max() ones, seems because of 
"this->fill()".

This could be changed easily, though i think we should see which is the better
(standard) behavior (use fill in all cases or exclude showbase case) ?

this is the code i talking based on(contrib/libc++/include/ostream):

<code>

template <class _CharT, class _Traits>
basic_ostream<_CharT, _Traits>&
basic_ostream<_CharT, _Traits>::operator<<(unsigned long long __n)
{
#ifndef _LIBCPP_NO_EXCEPTIONS
    try
    {
#endif  // _LIBCPP_NO_EXCEPTIONS
        sentry __s(*this);
        if (__s)
        {
            typedef num_put<char_type, ostreambuf_iterator<char_type,
traits_type> > _Fp;
            const _Fp& __f = use_facet<_Fp>(this->getloc());
            if (__f.put(*this, *this, this->fill(), __n).failed())
                this->setstate(ios_base::badbit | ios_base::failbit);
        }
#ifndef _LIBCPP_NO_EXCEPTIONS
    }
    catch (...)
    {
        this->__set_badbit_and_consider_rethrow();
    }
#endif  // _LIBCPP_NO_EXCEPTIONS
    return *this;
}

</code>


regards, Mokhi.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the freebsd-amd64 mailing list