本文介绍了结构对齐规则的目的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我想知道为什么引入了结构对齐规则。

有/无边界对齐的结构有何不同。


问候

Swapna

Hi,
I would like to know why structure alignment rules were introduced.
How does a structure with/without boundary alignments differ.

Regards
Swapna

推荐答案





一般来说,与今天的内存系统数量相比,这种浪费相对较低(每个结构几个字节)。因此,除非你有很多这样的结构,否则浪费可能是微不足道的。


如果你有大量的结构或有限的记忆,那么减少这种浪费可能是明智的。你可以通过仔细制作你的结构来做到这一点,举个例子

Generally speaking this wastage is relatively low (a few bytes per structure) compared to the amount of memory systems tend to have today. So unless you have a lot of those structures the wastage is probably negligible.

If you have a very large number of structures or limited memory then reducing this wastage may be sensible. You can do this by crafting your structures carefully, take this example

展开 | 选择 | Wrap | 行号


这篇关于结构对齐规则的目的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-23 22:48