Boost logo

Boost Users :

Subject: [Boost-users] Problem with -Wall and Property Tree
From: José Tomás Tocino García (theom3ga_at_[hidden])
Date: 2010-06-08 06:23:03


Hi there,

I've started to use boost::property_tree to parse some ini files, and I'm
getting an error when I compile using -Wall on gcc 4.4.3.
For this testcase:

#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ini_parser.hpp>

#include <iostream>
using namespace std;

class Reader{
    boost::property_tree::ptree myTree;
public:
    Reader(){
        read_ini("config.ini", myTree);
        cout << myTree.get<float>("sonido.limite", 0.);
    }
};

int main(int argc, char *argv[])
{
    Reader r;
}

If I compile using "g++ -o program testcase1.cpp -I." I get no errors, but
if I add "-Wall", I get:

./boost/property_tree/detail/ptree_implementation.hpp: In function ‘int
main(int, char**)’:
./boost/property_tree/detail/ptree_implementation.hpp:728: warning:
dereferencing pointer ‘default_value’ does break strict-aliasing rules
/usr/include/boost/optional/optional.hpp:422: note: initialized from here

What's the problem? It compiles and works properly, but it would be great to
have a warning-free compilation output.

Thanks in advance.

-- 
José Tomás Tocino García


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