Home » U++ Library support » U++ Core » unexpected output while reading the size of structure.
Re: unexpected output while reading the size of structure. [message #34771 is a reply to message #34755] |
Mon, 12 December 2011 09:41  |
cbpporter
Messages: 1428 Registered: September 2007
|
Ultimate Contributor |
|
|
The size of 16 is correct. There are very good technical reasons for it to be so and Novo pointed out some links. Unless you have very good reasons to use an unaligned/packed struct, I would recommend against it.
One thing that you could try is reorder the elements. There is this old trick of ordering elements, with the largest/more alignment constrained ones first. So put the double first, then the int, then the char.
If you are using binary storage an rely on fixed size (like 13) the solution is to read/write each field separately.
|
|
|
Goto Forum:
Current Time: Mon Aug 04 00:36:25 CEST 2025
Total time taken to generate the page: 0.07169 seconds
|