Re: [eigen] Re: Passing Eigen objects by value

[ Thread Index | Date Index | More lists.tuxfamily.org/eigen Archives ]


Hi Blazej,

My best guess is that when Eigen was initially developed targeting c++03, there wasn't a standard way of ensuring that parameters passed by value retain their alignment. With modern C++, in theory you can do that using alignas.



On Mon, Nov 16, 2020 at 4:48 AM Blazej Slusarek <blazej.86@xxxxxxxxx> wrote:
Bumping the thread. Does anyone know anything about this?

BR,
Blazej

On Fri, Nov 6, 2020 at 11:10 AM Blazej Slusarek <blazej.86@xxxxxxxxx> wrote:
Hello!

I recently stumbled upon this link: https://eigen.tuxfamily.org/dox/group__TopicPassingByValue.html
which (in short) says that passing Eigen objects by value is wrong. I'd like to get more info on that:
* When is this wrong? Is the object aligned when I create it but not when I make a copy of it on stack to pass it to a function? Could someone provide an example explaining what goes wrong?
* How is this avoided in case of returning by value?
* Does this affect custom-defined types of like Eigen::Matrix<2, -1, 0, 2, 3> (or Eigen::Matrix<2, 3, 0, 2, 3>) ?

Best regards,
Blazej


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/