Boost logo

Boost :

From: Miko Nahum (miko_at_[hidden])
Date: 2005-11-10 02:12:31


Hi
 
I need your example in compilation errors on code uses boost under
Windows VC7 and HP-UX 11.11 aCC 3.55 in 64 bit mode.
 
We have the boost 1.31.0 successfully installed and used in our
products, in SunOS using Forte 6.5.3 CC, HP 11.11 using aCC 3.33,
Windows (W2k, XP) using VC6.
 
While porting our code to 64 bit, we have upgraded the development env`
to Forte 8.5.5 CC on Sun, aCC 3.55 on HP and VC7 on Windows.
 
Compilation of boost itself had no problem. However, compilation of our
products that using it has been failed on HP and Windows.
 
1. Problems on Windows:
 
We have the following piece of code that uses boost (copy/paste):
 
#include "boost/regex.h"
#include "boost/regex.hpp"
 
using namespace boost;
using namespace std;

typedef boost::reg_expression<char> re_type;
typedef re_type::allocator_type allocator_type;

long example_func(long pos, const std::string& regE, long& reslen, long
max)
{
  long res;
  boost::match_results <PData::iterator, allocator_type> m;
 
  allocator_type (a);
  re_type e (a);
 
  e.set_expression (regE, regbase::normal);
 
  if (regex_search (begin (), end (), m, e, match_not_dot_newline |
match_not_dot_null)) <-- line 4790
  {
    res = pos + m.position();
    reslen = m.length();
    return res;
  }
.
.
.
 
 
Compiling the above produce the following error:
 
 
parser.cpp
z:\n2_3rd_party_components\boost\delivery\include\boost\regex\v4\perl_ma
tcher_common.hpp(208) : error C2228: left of '.second' must have
class/struct/union type
        type is 'const std::allocator<_Ty>::value_type'
        with
        [
            _Ty=char
        ]
 
z:\n2_3rd_party_components\boost\delivery\include\boost\regex\v4\basic_r
egex.hpp(243) : while compiling class-template member function 'bool
boost::re_detail::perl_matcher<BidiIterator,Allocator,traits,Allocator2>
::find_imp(void)'
        with
        [
            BidiIterator=PData::iterator,
            Allocator=allocator_type,
            traits=boost::regex_traits<char>,
            Allocator2=std::allocator<char>
        ]
        c:\Program Files\Microsoft Visual Studio .NET
2003\Vc7\include\xlocmon(190) : while compiling class-template member
function
'boost::re_detail::perl_matcher<BidiIterator,Allocator,traits,Allocator2
>::perl_matcher(BidiIterator,BidiIterator,boost::match_results<BidiItera
tor,Allocator> &,const boost::reg_expression<charT>
&,boost::regex_constants::match_flag_type)'
        with
        [
            BidiIterator=PData::iterator,
            Allocator=allocator_type,
            traits=boost::regex_traits<char>,
            Allocator2=std::allocator<char>,
            charT=char
        ]
 
z:\n2_3rd_party_components\boost\delivery\include\boost\regex\v4\regex_s
earch.hpp(38) : see reference to class template instantiation
'boost::re_detail::perl_matcher<BidiIterator,Allocator,traits,Allocator2
>' being compiled
        with
        [
            BidiIterator=PData::iterator,
            Allocator=allocator_type,
            traits=boost::regex_traits<char>,
            Allocator2=std::allocator<char>
        ]
        z:\med2\dev\ParserLib\parser.cpp(4790) : see reference to
function template instantiation 'bool
boost::regex_search<PData::iterator,allocator_type,char,boost::regex_tra
its<charT>,std::allocator<_Ty>>(BidiIterator,BidiIterator,boost::match_r
esults<BidiIterator,Allocator> &,const boost::reg_expression<charT>
&,boost::regex_constants::match_flag_type)' being compiled
        with
        [
            charT=char,
            _Ty=char,
            BidiIterator=PData::iterator,
            Allocator=allocator_type
        ]

"z:\med2\dev\ParserLib\parser.cpp(4790)" is marked above with red.
 
"z:\n2_3rd_party_components\boost\delivery\include\boost\regex\v4\regex_
search.hpp(38)" is listed below:
 
template <class BidiIterator, class Allocator, class charT, class
traits, class Allocator2>
bool regex_search(BidiIterator first, BidiIterator last,
                  match_results<BidiIterator, Allocator>& m,
                  const reg_expression<charT, traits, Allocator2>& e,
                  match_flag_type flags = match_default)
{
   if(e.flags() & regex_constants::failbit)
      return false;
 
   re_detail::perl_matcher<BidiIterator, Allocator, traits, Allocator2>
matcher(first, last, m, e, flags); <-- line 38
   return matcher.find();
}

"z:\n2_3rd_party_components\boost\delivery\include\boost\regex\v4\perl_m
atcher_common.hpp(208)" is part of the following function:
template <class BidiIterator, class Allocator, class traits, class
Allocator2>
bool perl_matcher<BidiIterator, Allocator, traits,
Allocator2>::find_imp()

and the line (208) is listed below:
 
      // start again:
      search_base = position = m_result[0].second;
<-- line 208
      // If last match was null and match_not_null was not set then
increment
      // our start position, otherwise we go into an infinite loop:

 
Searching Google for this problem did not help very much, so I was
wondering if you have encounter it and put more light on it and the
solution?
 
 
2. Problems on HP:
 
2.1.
 
Error 24:
"/VOBS/netrac2_3rd_party/boost/delivery/include/boost/regex/v4/regbase.h
pp", line 53 # '<identifier>' expected instead of 'collate'.
          perlex = collate << 1, // perl extensions
                   ^^^^^^^
Error 164:
"/VOBS/netrac2_3rd_party/boost/delivery/include/boost/regex/v4/regbase.h
pp", line 53 # Integral type expected for operator '<<'; types found
were '<no type>' and 'int'.
          perlex = collate << 1, // perl extensions
                           ^^^^
We do not understand why the error occurs, can you help with that? from
some reason, HP's aCC doesn't like the "collate".
Again, same as with problem #1, google it did not produce any useful
information.
 
We have workaround this problem as follow:
 
changed:

     collate = icase << 1, // use locale specific
collation
     perlex = collate << 1, // perl extensions

to:

     collate = icase << 1, // use locale specific
collation
     _collate = icase << 1,
     perlex = _collate << 1, // perl extensions

 
 What do you think about this solution?
 
2.2. Fixing above problem have exposed a problem similar to the Windows
problem.
 
 
Btw, both problems #1 and #2.2 were solved when set #define
BOOST_NO_STD_ALLOCATOR
 
 
Regards,
Miko Nahum
 


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk