Memory problem and BT compiler
Toss by this issue until now. It is different from that you have encountered. The code always has illegal pointer problems, check the language is correct, after a hard track, get a typical case see map, with the PCONNSET-> RCLIENT to take the address, the value seen in the monitor window is 0x11f428.
Define variables Reconn * P, assignment recconn * p = & pConnset-> rclient; results see 0x11f434. Differentiation 12 bytes. Very very surprised, just a & operator and = operation symbol, can you get a different value? ? ! ! ! Too wonderful! !
Large picture
Use P-pass values to cause memory pointer errors in the iPlogin function. Use & pConnset-> Rclient to IPLogin is also the same! Certification The value and variable monitoring window see is not a matter!
The PCONNSET structure is defined as follows
TypedEf struct __recconnset {recconncallback rcallback; / * Tune function * / Reccfgpara rcfgpara; / * Configuration parameter * / recconn rclient; Recconn rlistener; Reconn Rservers [MAX_CONN_CLIENTS];} ReconnSet;
First, there is a problem with the situation of structural alignment, so I define #pragma pack (1), or set the alignment to 1 in the project C / C -> Code Generation, not used.
Then doubt it is a CPP and C mixing problem, change the C file in which the code is located to CPP recompilation (C strict type check, adding a lot of code modifications, bitter). Still useless.
Helpless, modify the structural RCALLBACK and RCFGPARA before RCLIENT, so that the internal members are strictly aligned in 4 bytes, and the internal members' plastic, enumeration, and string variables are continuously placed.
Re-compile, it is like it .... I am bored! I feel that this compiler is absolutely problematic! This is not necessarily a code problem but the compilation option is even possible to be a compiler bug or too bt code generation rule .... is really depressed!
In addition, there is a depressed, VC this is broken, I don't know what is wrong. When the single step tracking, some files are wrong, such as the code actually runs to 100 lines, but the tracking cursor points to It is 86 lines, and I am pushing, I am watching my eyes, I have to locate frequent printing logs and viewing calls ... and only have a pair (not the most important) file, the code tracking of other files Point to all right! Re-relying again! !
So far, I really want to call: I am exhausted! !
Finally, basic confirmation is because some files are not correctly compiled. The evil VC6 ... After the SP5 is finished, it is much better.