another effc++ spurious warning?

Paolo Carlini pcarlini@suse.de
Thu Jul 8 12:52:00 GMT 2004


Giovanni Bajo wrote:

>Benjamin,
>
>I see many instances of this while compiling with -Weffc++:
>
>/home/farfetch/gcc/mainline/out/i686-pc-linux-gnu/libstdc++-v3/include/bits/str
>eambuf_iterator.h:235: warning: postfix `std::ostreambuf_iterator<_CharT,
>_Traits>& std::ostreambuf_iterator<_CharT, _Traits>::operator++(int) [with
>_CharT = wchar_t, _Traits = std::char_traits<wchar_t>]' should return
>`std::ostreambuf_iterator<wchar_t, std::char_traits<wchar_t> >'
>
>What is your position on this? I did not check the code, but shouldn't
>operator++(int) return a temporary? Or maybe not for output/input iterators?
>  
>
Hi Giovanni (while Benjamin is still asleep ;)

The relevant item is 24.5.4.2, p4: according to it "[operator++(int)] 
Returns: *this."

Therefore, I cannot see anything wrong with our implementation:

      /// Return *this.
      ostreambuf_iterator&
      operator++(int)
      { return *this; }

...

Paolo.



More information about the Libstdc++ mailing list