Re: [eigen] Clang issue on MacOS when the set variable is used in the given data

```On 19.04.2013 12:05, Gael Guennebaud wrote:
```
```Your second version should be ok because you do not read foo(0) after
it has been changed, but that's still a dangerous use.
```
```
Does Eigen give any guarantees on how comma-initialization is performed?.
I always assumed that
foo << A, B, C;
is basically the same as
foo.segment<dim_A>(0          ) = A;
foo.segment<dim_B>(dim_A      ) = B;
foo.segment<dim_C>(dim_A+dim_B) = C;

```
E.g., generally it would make sense to evaluate the result of rot*foo.block(...) directly into the corresponding position of foo. That quite certainly can lead to aliasing issues (but does not have to for small matrices).
```
```
```On Thu, Apr 18, 2013 at 8:58 AM, Arnaud BARRE <arnaud.barre@xxxxxxxxx> wrote:
```
```For example, I have the following code:
Eigen::Matrix<double,4,1> foo;
foo << I, 1.0;
foo << 0.0, rot * (inv * foo).block(1,0,2,1), 1.0;
*JC = (local * foo).block(0,0,3,1);
```
```
```
What I don't understand here, is why you need to use foo for two different temporaries? You can hardly be that short of memory. Furthermore, what is inv? If it was a Eigen::Transform, you can directly multiply by a 3d vector (no need to explicitly construct [I, 1.0]).
```
Assuming local is a Transform as well:
Eigen::Vector3d foo;
foo << 0, rot * (inv * I).tail<2>();
*JC = local * foo;

```
And if inv does not fit into a Transform, you can use I.homogeneous() instead of (foo << I, 1.0);
```

Christoph

--
----------------------------------------------
Dipl.-Inf., Dipl.-Math. Christoph Hertzberg
Cartesium 0.049
Universität Bremen
Enrique-Schmidt-Straße 5
28359 Bremen

Tel: +49 (421) 218-64252
----------------------------------------------

```

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