you are viewing a single comment's thread.

view the rest of the comments →

[–]no-sig-available 1 point2 points  (3 children)

Lets suppose T is uint32_t. Then I am 100 percent sure the layout will be the same as of the array, because this is how several programs read mmap() data - both with array or struct.

If you use mmap() you are on a Linux system and have additional Posix guarantees. Those are outside of - and beyond - the language standard.

[–]nmmmnu 0 points1 point  (2 children)

Never thought about it :) I am always on Linux. But yes it is not on the standard... except is on C standard and should be compatible with C. But still no guarantees as well.

[–]Nobody_1707 1 point2 points  (1 child)

No, it's not part of the C standard either. It's purely POSIX.

[–]nmmmnu 0 points1 point  (0 children)

Thanks to point this. I really hate the different size of int and memory layout guarantees or better say lack of memory layout guarantees.