M
marko.suonpera
I'm using the Newmat library where element access in ColumnVector type
is defined as follows:
typedef double Real;
Real& ColumnVector:perator()(int m)
{
REPORT
if (m<=0 || m> nrows) Throw(IndexException(m,*this));
return store[m-1];
}
Real ColumnVector:perator()(int m) const
{
REPORT
if (m<=0 || m> nrows) Throw(IndexException(m,*this));
return store[m-1];
}
(store is a Real* )
Now I call a function with columnvector argument:
ColumnVector a;
//set values of a
//....
double temp = a(1);
func(a);
void func(const ColumnVector &a)
{
double temp = a(1); //invalid floating point operation
}
The first element access double temp = a(1) in the calling function
works ok. In function func() this causes invalid floating point
operation. The message says "Project XXX raised exception class
C0000092 with message "floating point stack check at 0x429191."
Process stopped." If I check the contents of ColumnVector::store with
the debugger, it shows the correct value without problems.
However, if I change the function definition to without const: void
func(ColumnVector &a), it works ok. Also there are other functions of
similar type (with const definition), which work ok. What would cause
this problem?
BR, Marko
is defined as follows:
typedef double Real;
Real& ColumnVector:perator()(int m)
{
REPORT
if (m<=0 || m> nrows) Throw(IndexException(m,*this));
return store[m-1];
}
Real ColumnVector:perator()(int m) const
{
REPORT
if (m<=0 || m> nrows) Throw(IndexException(m,*this));
return store[m-1];
}
(store is a Real* )
Now I call a function with columnvector argument:
ColumnVector a;
//set values of a
//....
double temp = a(1);
func(a);
void func(const ColumnVector &a)
{
double temp = a(1); //invalid floating point operation
}
The first element access double temp = a(1) in the calling function
works ok. In function func() this causes invalid floating point
operation. The message says "Project XXX raised exception class
C0000092 with message "floating point stack check at 0x429191."
Process stopped." If I check the contents of ColumnVector::store with
the debugger, it shows the correct value without problems.
However, if I change the function definition to without const: void
func(ColumnVector &a), it works ok. Also there are other functions of
similar type (with const definition), which work ok. What would cause
this problem?
BR, Marko