two-dimensional C array and its analog in D
Alexandr Druzhinin
drug2004 at bk.ru
Wed Aug 8 07:12:46 PDT 2012
08.08.2012 16:29, bearophile пишет:
>> That C code doesn't look correct, because the given data contains no
>> pointers.
>
> But this C code compiles:
>
>
> void foo(const void** data) {}
> int data[2][3];
> int main() {
> foo(data);
> return 0;
> }
>
> Bye,
> bearophile
As I know in C an array is equal to pointer, so array of array == array
of pointers == pointer to pointer == pointer to array. Correct me if I'm
wrong.
I'm trying to use OpenGL function glMultiDrawElements. It has signature:
void glMultiDrawElements(
enum mode,
sizei *count,
enum type,
void **indices,
sizei primcount
);
If I declare indices like
uint[][] indices;
then code compiles but doesn't work (but it works in C). If I do as I
described in the first post - it works in D. And I'd like to understand
the reason of it. I think the reason is difference tween C array and D
array, but I'm not sure.
p.s. example of real code is too large to paste
More information about the Digitalmars-d-learn
mailing list