Boost logo

Boost Users :

Subject: [Boost-users] [String Algo] funny warning
From: Leo Cacciari (leo.cacciari_at_[hidden])
Date: 2011-10-02 14:12:59


Hi,
I usualy add flag -Wall to gnu g++ compilation while developing. Now, I
got a funny warning while compiling the following function (I use the
1.42.0 release of boost)

std::vector<std::string>
split_payload(const std::string & payload_string) {
  std::vector<std::string> components;
  boost::algorithm::split(components,payload_string,
                          boost::algorithm::is_any_of(","));
  return components;
}

The warning I get is

/usr/include/c++/4.4/bits/stl_algo.h: In function
‘std::vector<std::basic_string<char, std::char_traits<char>,
std::allocator<char> >, std::allocator<std::basic_string<char,
std::char_traits<char>, std::allocator<char> > > > split_payload(const
std::string&)’:
/usr/include/c++/4.4/bits/stl_algo.h:2178: warning: array subscript is
above array bounds

Someone could explain this? By the way, the function does what is
supposed to do, so its not a big problem, but I'd really like to
understand what the problem is...

-- 
Leo Cacciari
Aliae nationes servitutem pati possunt populi romani est propria libertas

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net