Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
D中的数组是否碎片化?将指向第一个参数的指针传递给采用 C 数组的 C 函数是否安全?C 函数将覆盖数组内容。C 函数采用长度参数,因此它不需要以 NULL 结尾。(不是字符串)
不,D 数组是连续的。
D 数组在内部表示为指针和长度,仅此而已。
http://dlang.org/arrays.html#dynamic-arrays
它们是连续的,您可以使用该字段获取指向第一个元素的指针.ptr。
.ptr