(EDIT) it was std::string b; NOT int b;
Sorry about that.
Hi all! I am a new software engineer (working for 2 years now) and I am doing my start at video game programming!
I am curently starting to code my game and I am doing a memory manager.
My question is: Mike in his book says: "Any N-byte data type is memory aligned if the starting address is evenly divisible by N".
My problem is:
I create a small program:
int main()
{
char a;
std::string b;
std::cout << sizeof(b) << std::endl;
std::cout << &b << std::endl;
}
.
The result I get is:
32
003bf864.
So, the problem is that (hex)003bf864 = (dec)3930212 % 32 != 0 !
So, does that mean that my string is not aligned?
Thanks!
Sorry about that.
Hi all! I am a new software engineer (working for 2 years now) and I am doing my start at video game programming!
I am curently starting to code my game and I am doing a memory manager.
My question is: Mike in his book says: "Any N-byte data type is memory aligned if the starting address is evenly divisible by N".
My problem is:
I create a small program:
int main()
{
char a;
std::string b;
std::cout << sizeof(b) << std::endl;
std::cout << &b << std::endl;
}
.
The result I get is:
32
003bf864.
So, the problem is that (hex)003bf864 = (dec)3930212 % 32 != 0 !
So, does that mean that my string is not aligned?
Thanks!
The post was edited 1 time, last by Torous ().