문제

Are arrays in D fragmented? Is it safe to pass a pointer to the first argument to a C function taking a C-array? The C function will override the array contents. The C function takes a length parameter so it doesn't need to be NULL terminated. (It's not a string)

도움이 되었습니까?

해결책 2

They are continuous and you can get the pointer to the first element with the .ptr field.

다른 팁

No. D arrays are continuous.

D arrays are internally represented as a pointer and a length, that is all.

http://dlang.org/arrays.html#dynamic-arrays

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top