Hi
How do you determine the size required by a Value type on the stack ?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Jul 9, 2012, 12:59 PM
For example, this program won't compile because MyStruct contains a string field:
All you can do in these case is to work out the size manually - a reference needs 4 bytes on a 32-bit system or 8 bytes on a 64-bit system - though the matter is complicated by having to allow for 'padding' between fields as well.
Satyapriya NayakPosted Jul 9, 2012, 12:14 PM
The sizeof operator is used to obtain the size in bytes for a value type.
Thanks