c++ - get heap corruption when changing member variables order -


I have a strange problem with my class between others- the following memers:

  Gibbone has_alpha; Glutton width; Glutton height; Glutton length; Glumeant millis perframe; GL Float UV [2]; Glutton Texas [2]; GLint compsize; // place 2 long preload_interval_next; Long before load_invers;  

If I put the has_alpha in (position 2) I

a) Different object sizes, sizeof report 248 instead of 258 bytes

And

b) Heavy Stack Corruption

GBBoyan is defined as an unsigned four, but since I do not use any customization at all (it double checked ) Then it should be pad in 4 bytes too. And finally, if it is a pad, then it should be done at both places.

Compiler Test: CLANG (c ++), GCC 4.2 com.apple.compilers.llvmgcc42

How can anyone track down this idea?

The problem here is listed almost not in the members you have, but another, possibly a Int , indicator or bool does not start properly in the manufacturer . Please post a great example that fails, and make sure that you start all the members using the Constructor Initialization list.


Comments

Popular posts from this blog

oracle - The fastest way to check if some records in a database table? -

php - multilevel menu with multilevel array -

jQuery UI: Datepicker month format -