Opened 13 years ago

Closed 12 years ago

#3846 closed Patches (fixed)

Boost.Interprocess getline(istream, basic_string, CharT) contains duplicated variable int c1

Reported by: wlam@… Owned by: Ion Gaztañaga
Milestone: Boost 1.45.0 Component: interprocess
Version: Boost 1.41.0 Severity: Cosmetic
Keywords: Cc: Wang Lam <wlam@…>

Description

As of Boost 1.41.0 (and in SVN as of today, 18 Jan 2010), the Boost.Interprocess container library implements

template <...> std::istream &getline(std::istream&, basic_string<...> &, CharT)

in

boost/interprocess/containers/container/string.hpp

with the following snippet:

Line 2276:

int c1; while (nread < s.max_size()) {

int c1 = buf->sbumpc();

: }

The outer declaration of c1 can trigger an (apparently correct) unused-variable warning in gcc. If the declaration is indeed unnecessary (e.g., is not some compiler-bug workaround), it looks trivial to remove:

--- /home/wlam/boost_1_41_0/boost/interprocess/containers/container/string.hpp 2009-10-15 11:46:26.000000000 -0700 +++ ../boost/interprocess/containers/container/string.hpp 2010-01-18 20:29:36.635619313 -0800 @@ -2273,7 +2273,6 @@

std::basic_streambuf<CharT, Traits>* buf = is.rdbuf(); s.clear();

  • int c1;

while (nread < s.max_size()) {

int c1 = buf->sbumpc(); if (Traits::eq_int_type(c1, Traits::eof())) {

Change History (1)

comment:1 by Ion Gaztañaga, 12 years ago

Milestone: Boost 1.42.0Boost-1.45.0
Resolution: fixed
Status: newclosed

Fixed for Boost 1.45 in release branch

Note: See TracTickets for help on using tickets.