Article ID: 170514
Article Last Modified on 7/5/2005
// Compile options needed to reproduce the bug: /Og
// Compile options needed to work around the bug: /Og /Op
#include <stdio.h>
#include <math.h>
struct A {
double m_X;
double m_Y;
};
typedef double rg23[2][3];
struct B
{
rg23 m;
B(double rotn = 0);
void func(double *px, double *py) const;
virtual ~B(){}
};
B::B(double rotn)
{
double cosa = cos(rotn);
double sina = sin(rotn);
m[0][0] =
m[1][1] = cosa;
m[0][1] = -sina;
m[1][0] = sina;
m[0][2] =
m[1][2] = 0;
}
void B::func(double *px, double *py) const
{
double x = *px;
double y = *py;
*px = x * m[0][0] + y * m[0][1] + m[0][2];
*py = x * m[1][0] + y * m[1][1] + m[1][2];
}
int main () {
A a;
a.m_X=1.0;
a.m_Y=2.0;
printf("Values in: x=%lf; y=%lf\n", a.m_X, a.m_Y);
B ct;
ct.func(&a.m_X, &a.m_Y);
printf("Values out: x=%lf; y=%lf\n", a.m_X, a.m_Y);
return 0;
}
Values in: x=1.000000; y=2.000000 Values out: x=1.000000; y=2.000000
Values in: x=1.000000; y=2.000000 Values out: x=1.000000; y=0.000000
Keywords: kbbug kbfix kbvc600fix kbcode KB170514