Skip to content

Question about handling of array messages #219

@anhosi

Description

@anhosi

I am not sure whether this is the correct place for this issue. So please direct me to a better location.

Together with @Karsten1987 we stumbled over

auto vector = reinterpret_cast<std::vector<unsigned char> *>(field);
.

I have only limited understanding about the whole rmw. As far as I understand a array message member that is originally represented as a std::vector<T> * is reinterpret_casted to a std::vector<unsigned char> * with a void * as intermediate. IMHO this is not guaranteed to work by the C++ standard as implementations are allowed to use different template specializations of std::vector for different types. There are only guarantees for the memory layout of a vectors data().
As far as I can tell the above code is only the symptom as the void * field here is part of what is passed into rmw_serialize as ros_message. Maybe it would be better to pass only the data() pointer of the vector at some point instead of the whole vector as void *?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions