Re: Question about arrays

2012-04-23 Thread Steven Schveighoffer
On Sat, 21 Apr 2012 18:25:44 -0400, Ali Çehreli wrote: In D, arrays are what they should have been in C :). A pointer and a size. Something the equivalent of the following (for the int type): struct int_Array { int * elements; size_t number_of_elements; } Technically speaking, th

Re: Question about arrays

2012-04-22 Thread Ali Çehreli
On 04/22/2012 03:17 PM, Stephen Jones wrote: > Thanks for the replies. I am still uncertain about something. The > documentation distinguishes between dynamic slices (int[5] a = new > int[5]) The documentation may be incorrect because int[5] is never a slice. It is a fixed-length array. As an

Re: Question about arrays

2012-04-22 Thread jerro
On Sunday, 22 April 2012 at 23:01:26 UTC, jerro wrote: On Sunday, 22 April 2012 at 22:17:11 UTC, Stephen Jones wrote: Thanks for the replies. I am still uncertain about something. The documentation distinguishes between dynamic slices (int[5] a = new int[5]) which are managed by the runtime, an

Re: Question about arrays

2012-04-22 Thread jerro
On Sunday, 22 April 2012 at 22:17:11 UTC, Stephen Jones wrote: Thanks for the replies. I am still uncertain about something. The documentation distinguishes between dynamic slices (int[5] a = new int[5]) which are managed by the runtime, and stack allocated arrays (int[5] b). The problem I have

Re: Question about arrays

2012-04-22 Thread Stephen Jones
Thanks for the replies. I am still uncertain about something. The documentation distinguishes between dynamic slices (int[5] a = new int[5]) which are managed by the runtime, and stack allocated arrays (int[5] b). The problem I have is this. I want to be loading vertex positions and tex-coords

Re: Question about arrays

2012-04-21 Thread Andrej Mitrovic
On 4/22/12, Stephen Jones wrote: > My C programming lies in cobwebs but from memory an array was a > pointer to the zeroth index of a set of uniformly sized chunks of > memory. I am perplexed to find that in D a call to an array (of > float vertices for example) cannot be accomplished by handing &

Re: Question about arrays

2012-04-21 Thread Ali Çehreli
On 04/21/2012 03:05 PM, Stephen Jones wrote: > My C programming lies in cobwebs but from memory an array was a pointer > to the zeroth index of a set of uniformly sized chunks of memory. Yes and no. :) What you are describing is the feature where an array decays to what you describe. But there

Question about arrays

2012-04-21 Thread Stephen Jones
My C programming lies in cobwebs but from memory an array was a pointer to the zeroth index of a set of uniformly sized chunks of memory. I am perplexed to find that in D a call to an array (of float vertices for example) cannot be accomplished by handing &v to functions that need the zeroth in