Bitfields, why implementation specific?

心不动则不痛 提交于 2019-12-01 15:23:12

For the same reason so many other things are not strictly specified by the standard: To allow flexibility to produce a compliant compiler for a large number of platforms and systems, and still have an EFFICIENT compiler.

In particular, bitfields having to be stored in a particular bit/byte-order would make it horribly slow on machines whose natural byte-order is the "wrong way around".

Yes, it means that it's a right pain in the behind to make bitfields portable across multiple archiectures and platforms. If you really need that, then perhaps you should consider some other solution...

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!