P
pjones0
Guest
Firstly, the problem I describe l below, does not occur with any prior version of VS C++, i.e., 2008, 2012, 2013.
It would not be possible to repeat the issue without the entire project source code. The Project is an MFC/SDF type application (MainFrm, Doc and View) and also has several class functions. The class functions, are derived from the CDialog type; one of the class functions has two of its dialog input variables corrupted. At the instantiation of the dialog, the two corrupted variables are OK and printed OK to verify. Immediately after the dialog is initialized, the dialog is opened (.DoModal) and displayed and the variables are displayed OK. When the dialog OK button is pressed and the DDX occurs, the two variables become corrupted. I have included a code fragment to show the variables in the DataExchange, below (TB and P are the ones corrupted):
CDialog:
oDataExchange( pDX );
cprintf( "*** Init1 -- T1, T2, TB, P: %lf %lf %lf %lf\n", T1, T2, TB, P ); <--TB and P are both OK here--set to default values
DDX_Text( pDX, IDC_EDIT1, T1 );
DDV_MinMaxDouble( pDX, T1, -999999., 999999. );
DDX_Text( pDX, IDC_EDIT2, T2 );
DDV_MinMaxDouble( pDX, T2, -999999., 999999. );
DDX_Text( pDX, IDC_EDIT3, TB );
DDV_MinMaxDouble( pDX, TB, -999999., 999999. );
cprintf( "*** Init2 -- T1, T2, TB, P: %lf %lf %lf %lf\n", T1, T2, TB, P ); <--TB is Bad, P OK here
DDX_Text( pDX, IDC_EDIT4, G );
DDV_MinMaxLong( pDX, G, 1000000, 3000000 );
DDX_Text( pDX, IDC_EDIT5, CF );
DDV_MinMaxDouble( pDX, CF, 1., 35000. );
DDX_Text( pDX, IDC_EDIT6, P );
DDV_MinMaxDouble( pDX, P, -1., 5250000. );
cprintf( "*** Init3 -- T1, T2, TB, P: %lf %lf %lf %lf\n", T1, T2, TB, P ); <-- Both TB and P are bad here
The way they are corrupted is bizarre. The TB variable is fmod(T2,1000.) and P is fmod(CF,100.) Note that the two corrupted values are immediately prior to the variables in the EDIT fields of the dialog, which contain the variables that corrupt the two in question.
I have tried all different compiler/linker options, optimizations and structure packing. Nothing I have tried fixes this problem, in VS 2015 C++. Does anyone have a clue as to how to "fix" this issue???
Continue reading...
It would not be possible to repeat the issue without the entire project source code. The Project is an MFC/SDF type application (MainFrm, Doc and View) and also has several class functions. The class functions, are derived from the CDialog type; one of the class functions has two of its dialog input variables corrupted. At the instantiation of the dialog, the two corrupted variables are OK and printed OK to verify. Immediately after the dialog is initialized, the dialog is opened (.DoModal) and displayed and the variables are displayed OK. When the dialog OK button is pressed and the DDX occurs, the two variables become corrupted. I have included a code fragment to show the variables in the DataExchange, below (TB and P are the ones corrupted):
CDialog:
![Big grin :D :D](https://cdn.jsdelivr.net/joypixels/assets/8.0/png/unicode/64/1f600.png)
cprintf( "*** Init1 -- T1, T2, TB, P: %lf %lf %lf %lf\n", T1, T2, TB, P ); <--TB and P are both OK here--set to default values
DDX_Text( pDX, IDC_EDIT1, T1 );
DDV_MinMaxDouble( pDX, T1, -999999., 999999. );
DDX_Text( pDX, IDC_EDIT2, T2 );
DDV_MinMaxDouble( pDX, T2, -999999., 999999. );
DDX_Text( pDX, IDC_EDIT3, TB );
DDV_MinMaxDouble( pDX, TB, -999999., 999999. );
cprintf( "*** Init2 -- T1, T2, TB, P: %lf %lf %lf %lf\n", T1, T2, TB, P ); <--TB is Bad, P OK here
DDX_Text( pDX, IDC_EDIT4, G );
DDV_MinMaxLong( pDX, G, 1000000, 3000000 );
DDX_Text( pDX, IDC_EDIT5, CF );
DDV_MinMaxDouble( pDX, CF, 1., 35000. );
DDX_Text( pDX, IDC_EDIT6, P );
DDV_MinMaxDouble( pDX, P, -1., 5250000. );
cprintf( "*** Init3 -- T1, T2, TB, P: %lf %lf %lf %lf\n", T1, T2, TB, P ); <-- Both TB and P are bad here
The way they are corrupted is bizarre. The TB variable is fmod(T2,1000.) and P is fmod(CF,100.) Note that the two corrupted values are immediately prior to the variables in the EDIT fields of the dialog, which contain the variables that corrupt the two in question.
I have tried all different compiler/linker options, optimizations and structure packing. Nothing I have tried fixes this problem, in VS 2015 C++. Does anyone have a clue as to how to "fix" this issue???
Continue reading...