I used to C's fixed size of structure. Don't know if a C++ object is fixed or not. I mean is it always possible to predict what size is for an object? during compiling time? and/or run time? or impossible unless using sizeof operator? I knew it's hardware platform dependent. Beside that, what else?
A C++ object has a fixed size, of course. If it wasn't fixed, and you made an array of objects, how would the compiler know how much space to allocate?
The same rules that apply to structs apply here, the total from each type of data's size plus any padding for alignment and if you use any virtual functions that's an extra 4 or 8 bytes for the V table pointer depending on the architecture of your machine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With