سؤال

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