Boost logo

Boost :

From: Pedro Lamarão (pedro.lamarao_at_[hidden])
Date: 2005-06-24 20:49:00


The following test program doesn't work like I would expect.

#include <iostream>
#include <string>

#include <boost/spirit/core.hpp>

int main () {
    using namespace std;
    using namespace boost::spirit;

    typedef rule<scanner<string::iterator> > rule_t;

    string s;
    s += char(0x81);

    cout << (char(0x80) < char(0xFF)) << endl;

    rule_t test = range_p(0x80, 0xFF); // (*)

    parse_info<string::iterator> info = parse(s.begin(), s.end(),
                                              test);
    if (info.hit)
        cout << "Hit!" << endl;
    else
        cout << "Not hit." << endl;

    return 0;
}

This is the program output.

[pedro_at_localhost http_client]$ $HOME/.local/gcc-3.4.4/bin/g++ -g -I
../../../.. -Wall -Wextra test.cpp -fsigned-char && ./a.out
1
Not hit.

[pedro_at_localhost http_client]$ $HOME/.local/gcc-3.4.4/bin/g++ -g -I
../../../.. -Wall -Wextra test.cpp -funsigned-char && ./a.out
1
Hit!

[pedro_at_localhost http_client]$ $HOME/.local/gcc-3.4.4/bin/gcc -v
Reading specs from
/home/pedro/.local/gcc-3.4.4/lib/gcc/i686-pc-linux-gnu/3.4.4/specs
Configured with: ../configure --prefix=/home/pedro/.local/gcc-3.4.4
--enable-languages=c,c++
Thread model: posix
gcc version 3.4.4

--
 Pedro Lamarão

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