What does “there is no smaller array object that satisfies these constraints” mean?

后端 未结 1 2151
温柔的废话
温柔的废话 2021-02-20 01:04

The draft n4659 for C++17 describes the general principes of the language in chapter 4. In chapter 4.5, The C++ object model [intro.object], I cannot understand the meaning of o

相关标签:
1条回答
  • 2021-02-20 02:00

    The meaning if 3.3 is to differentiate a[32] from b[16]. The former doesn't provide storage for *p because the latter does. It identifies the smallest unique array object that provides the region of storage where the object resides.

    Without 3.3 the definition would be transitive. a[32] would provide storage for *p because it ultimately provides storage for b[16].


    Regarding *p using 4 bytes. It's important to note that the region [b->b + 4, b->b +8), while being the storage where *p resides, is not the array object providing the storage (that region isn't an array object at all). That smallest array object would be b->b.

    0 讨论(0)
提交回复
热议问题