Passing dynamic arrays into C.
Bernard Helyer
b.helyer at gmail.com
Sun Apr 25 04:50:59 PDT 2010
Guilty on all charges. Confused the behaviour of static and dynamic
arrays with sizeof.
On 25/04/10 21:54, bearophile wrote:
> Bernard Helyer:
>> glBufferData(GL_ARRAY_BUFFER, vertices.sizeof,
>> vertices.ptr, GL_STATIC_DRAW);
>>
>> glVertexPointer(2, GL_FLOAT, GLfloat.sizeof * 2, cast(void*)0);
>
> Are you sure that vertices.sizeof is right? It can be wrong. Maybe you want something like:
> (vertices[0]).sizeof * vertices.length
>
> That: cast(void*)0
> is better written:
> null
>
> The sizeof of a dynamic array is 2 CPU words.
>
> Bye,
> bearophile
More information about the Digitalmars-d-learn
mailing list