P
PCool
Hi all.. I am going crazy on this.
Using mingw32 g++ / gcc .
This struct is included from a .h file, and initialized with a LocalAlloc and a LocalReAlloc
When everything was working, the struct was like this:
typedef struct _THINGS_CALCULATED
{
double Big;
short First;
double Money;
double Change;
double Offered[GEN_SIZE]; // GEN_SIZE is 3
double Requested;
double Next;
bool Preferred;
short Summary;
bool IsRed;
bool IsGreen;
bool IsYellow;
} TCALC;
Then I needed an array of doubles, so I made it out of Requested
typedef struct _THINGS_CALCULATED
{
double Big;
short First;
double Money;
double Change;
double Offered[GEN_SIZE]; // GEN_SIZE is 3
double Requested[GEN_SIZE]; /// <-- new array, previously a simple double: NOTHING WORKS anymore
double Next;
bool Preferred;
short Summary;
bool IsRed;
bool IsGreen;
bool IsYellow;
} TCALC;
After this, some variables in other part of the software became corrupted.
A big mess, and it was a long work to track the problem to this file.
The fact is: even if I don't use at all Requested, and I rename it to NoUseRequested[GEN_SIZE] to be sure,
nothing changes: errors in the sw .
These errors appear to be like other variables (not in this struct), short or int, overwritten.
So an int that should look like "44" becomes "-123123123" etc.
If I put Requested after Preferred, everything works fine.
typedef struct _THINGS_CALCULATED
{
double Big;
short First;
double Money;
double Change;
double Offered[GEN_SIZE];
double Next;
bool Preferred;
double Requested[GEN_SIZE]; // CORRECT, all works
short Summary;
bool IsRed;
bool IsGreen;
bool IsYellow;
} TCALC;
But if I place it somewhere else, mostly it does not work anymore:
typedef struct _THINGS_CALCULATED
{
double Big;
short First;
double Money;
double Change;
double Offered[GEN_SIZE];
double Next;
bool Preferred;
short Summary;
bool IsRed;
bool IsGreen;
bool IsYellow;
double Requested[GEN_SIZE]; // WILL CAUSE BUGS APPEAR IN THE SOFTWARE
} TCALC;
Any hints explanations suggestions ?
paul
Using mingw32 g++ / gcc .
This struct is included from a .h file, and initialized with a LocalAlloc and a LocalReAlloc
When everything was working, the struct was like this:
typedef struct _THINGS_CALCULATED
{
double Big;
short First;
double Money;
double Change;
double Offered[GEN_SIZE]; // GEN_SIZE is 3
double Requested;
double Next;
bool Preferred;
short Summary;
bool IsRed;
bool IsGreen;
bool IsYellow;
} TCALC;
Then I needed an array of doubles, so I made it out of Requested
typedef struct _THINGS_CALCULATED
{
double Big;
short First;
double Money;
double Change;
double Offered[GEN_SIZE]; // GEN_SIZE is 3
double Requested[GEN_SIZE]; /// <-- new array, previously a simple double: NOTHING WORKS anymore
double Next;
bool Preferred;
short Summary;
bool IsRed;
bool IsGreen;
bool IsYellow;
} TCALC;
After this, some variables in other part of the software became corrupted.
A big mess, and it was a long work to track the problem to this file.
The fact is: even if I don't use at all Requested, and I rename it to NoUseRequested[GEN_SIZE] to be sure,
nothing changes: errors in the sw .
These errors appear to be like other variables (not in this struct), short or int, overwritten.
So an int that should look like "44" becomes "-123123123" etc.
If I put Requested after Preferred, everything works fine.
typedef struct _THINGS_CALCULATED
{
double Big;
short First;
double Money;
double Change;
double Offered[GEN_SIZE];
double Next;
bool Preferred;
double Requested[GEN_SIZE]; // CORRECT, all works
short Summary;
bool IsRed;
bool IsGreen;
bool IsYellow;
} TCALC;
But if I place it somewhere else, mostly it does not work anymore:
typedef struct _THINGS_CALCULATED
{
double Big;
short First;
double Money;
double Change;
double Offered[GEN_SIZE];
double Next;
bool Preferred;
short Summary;
bool IsRed;
bool IsGreen;
bool IsYellow;
double Requested[GEN_SIZE]; // WILL CAUSE BUGS APPEAR IN THE SOFTWARE
} TCALC;
Any hints explanations suggestions ?
paul