I'm trying to compile the following code with some c++ ARM compiler.
void pairs_converter(const mem_t& mem, uint16_t* data) {/* some stuff */}
template <typename StringT>
inline
void to_string(const mem_t& mem, StringT& s)
{
s.resize(24);
pairs_converter(mem, reinterpret_cast<uint16_t*>(&s[0]));
}
and I get the following error code :
error: cast from '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type*' {aka 'char*'} to 'uint16_t*' {aka 'short unsigned int*'} increases required alignment of target type [-Werror=cast-align]
pairs_converter(mem, reinterpret_cast<uint16_t*>(&s[0]));
from what I understood it looks like an alignment problem between some words and octets but I'm not fluent enough with c++ to understand how to tackle this compiler error.
I would be gratefull for some more detailed explanations on this c++ error !