tagged-pointer – make the pointer contain more information

13bOkrO.png

In C++, we can specify the alignment of a type in memory. For example, use __attribute__((aligned(4))) to align variables of this type with 4Byte. Generally, there are two main points to discuss the role of memory alignment:

  1. Cross-platform porting (related to hardware)
  2. Improve CPU access performance

This article is transferred from https://imcbc.cn/202211/tagged-pointer/
This site is only for collection, and the copyright belongs to the original author.