Tag Archives: xbox

Games Played 2015 Page

I have a new page up under the Reviews tab where I will be noting games I’ve played in 2015 to completion, close to, or ones worth noting in either a good or bad way. Each will be accompanied by a tiny blurb about my experience with a game. It will be my way of keeping track of games this year while also doing “reviews” of each in some way without losing interest and time in writing a huge blog about each. I hope someone besides me finds it helpful.

Today I Learned: Struct Packing With A Microsoft Twist

Member declaration order for structs and classes are important. You want to order the smallest to the largest (or vice versa) in order to avoid what’s known as ‘padding’. Padding is basically what the compiler will use to keep the memory allocation of the struct/class aligned in memory. This padding tends to be wasted space unless some compiler specific enhancement is occurring.

What I learned today was that Microsoft’s C++ compiler actually has extra padding involved, by design. And the solution to avoid the extra previous memory being stolen from you? Quite elementary, how could you not know? Inheriting from an empty abstract class makes your objects smaller.

Continue reading