[Rock-dev] [rock] #187: std::vector<bool> in type produces segmentaton fault

rock noreply at opendfki.de
Wed Jul 11 14:43:19 CEST 2012


#187: std::vector<bool>  in type produces segmentaton fault
------------------------------+-----------------------------------
 Reporter:  felix.rehrmann@…  |      Owner:  rock-dev-mailing-list
     Type:  defect            |     Status:  new
 Priority:  major             |  Milestone:
Component:  toolchain         |   Keywords:
------------------------------+-----------------------------------
 After discussion on rock-dev I put that as a ticket to have it in the
 system.

 Given the following data structure
 {{{
 struct Bumpers
 {
     // Number of Bumpers (specific per Robot)
     int nrFront;
     int nrRear;
     // States of Bumpers. See Aria Documentation and/or ArModes.cpp
     // for an Example how to read out these values.
     int front;
     int rear;

     std::vector<bool>  bumpersFront;
     std::vector<bool>  bumpersRear;

     base::Time time;
 };
 }}}
 a segmentation fault is produced when connecting to a port of this type
 via orocos.rb.
 After changing std::vector<bool>  to std::vector<int>  the segmentation
 fault was gone.

 Due to Thomas that is because containers are specialized for bools which
 is not recognized by typelib.

 Janosch proposed using uint8_t or the like as a workaround.

 Using a container with bool in a type should either throw an error at what
 point ever (orogen, runtime exception) or it should work.

-- 
Ticket URL: <http://rock.opendfki.de/ticket/187>
rock <http://rock.opendfki.de>
rock: the robot construction kit


More information about the Rock-dev mailing list