[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] strange 'data' pointers using more than one submatrix sim
From: |
Frank Reininghaus |
Subject: |
Re: [Help-gsl] strange 'data' pointers using more than one submatrix simultaneously |
Date: |
Thu, 4 Dec 2014 23:27:15 +0100 |
Hi,
2014-12-04 18:27 GMT+01:00 Matthias Sitte:
> Hi,
>
> I've got mixed results on different platforms when using more than one
> submatrix simultaneously.
you create the gsl_matrix_view objects view1 and view2 as temporary
objects on the stack, inside nested {...} blocks in main(). In
particular, you create view2 after view1 went out of scope already.
One the machine where both pointers are equal, the memory that was
occupied by view1 is apparently being recycled for view2, which is not
really surprising.
Never use a pointer to an object on the stack after that object went
out of scope! The behavior of your program is undefined if you do.
Cheers,
Frank