Re: Array declaration warning

2015-06-04 Thread Meta via Digitalmars-d-learn
On Thursday, 4 June 2015 at 16:52:30 UTC, Ali Çehreli wrote: On 06/04/2015 04:27 AM, Meta wrote: > On Wednesday, 3 June 2015 at 21:05:42 UTC, Ali Çehreli wrote: >> a[] = b;// makes the elements of 'a' same as 'b's elements > Isn't a[] = b deprecated syntax? I believe you have to use a[]

Re: Array declaration warning

2015-06-04 Thread Ali Çehreli via Digitalmars-d-learn
On 06/04/2015 04:27 AM, Meta wrote: > On Wednesday, 3 June 2015 at 21:05:42 UTC, Ali Çehreli wrote: >> a[] = b;// makes the elements of 'a' same as 'b's elements > Isn't a[] = b deprecated syntax? I believe you have to use a[] = b[] now. Thanks. Unfortunately, 2.067.1 'dmd -w -de' is st

Re: Array declaration warning

2015-06-04 Thread Meta via Digitalmars-d-learn
On Wednesday, 3 June 2015 at 21:05:42 UTC, Ali Çehreli wrote: On 06/03/2015 01:45 PM, Paul wrote: > On Wednesday, 3 June 2015 at 20:33:02 UTC, Ali Çehreli wrote: >> > pathList[][n] ~= CoOrd(cX, cY); >> >> I don't think you need the empty [] there. pathList[n] is one of the >> paths and you are a

Re: Array declaration warning

2015-06-03 Thread Ali Çehreli via Digitalmars-d-learn
On 06/03/2015 01:45 PM, Paul wrote: > On Wednesday, 3 June 2015 at 20:33:02 UTC, Ali Çehreli wrote: >> > pathList[][n] ~= CoOrd(cX, cY); >> >> I don't think you need the empty [] there. pathList[n] is one of the >> paths and you are adding a coordinate to it: > > Urgh, *that* is how I was confusi

Re: Array declaration warning

2015-06-03 Thread Paul via Digitalmars-d-learn
On Wednesday, 3 June 2015 at 20:33:02 UTC, Ali Çehreli wrote: > pathList[][n] ~= CoOrd(cX, cY); I don't think you need the empty [] there. pathList[n] is one of the paths and you are adding a coordinate to it: Urgh, *that* is how I was confusing myself, the rest of the code 'looks right'. St

Re: Array declaration warning

2015-06-03 Thread Paul via Digitalmars-d-learn
On Wednesday, 3 June 2015 at 20:38:54 UTC, anonymous wrote: Declarations are right to left, accesses are left to right. Succinctly put, even I should be able to remember that. Paul

Re: Array declaration warning

2015-06-03 Thread anonymous via Digitalmars-d-learn
On Wednesday, 3 June 2015 at 20:28:57 UTC, Paul wrote: Ooops, this is what I meant to post: struct CoOrd { int x, y; } CoOrd[][NumPaths]pathList; I append values like so... pathList[][n] ~= CoOrd(cX, cY); The "[]" does nothing here. You can leave it (or add more) out without chang

Re: Array declaration warning

2015-06-03 Thread Ali Çehreli via Digitalmars-d-learn
On 06/03/2015 01:28 PM, Paul wrote: > Ooops, this is what I meant to post: > > struct CoOrd > { > int x, y; > } > > CoOrd[][NumPaths]pathList; > > > I append values like so... > > pathList[][n] ~= CoOrd(cX, cY); I don't think you need the empty [] there. pathList[n] is one of the paths and

Re: Array declaration warning

2015-06-03 Thread Paul via Digitalmars-d-learn
Ooops, this is what I meant to post: struct CoOrd { int x, y; } CoOrd[][NumPaths]pathList; I append values like so... pathList[][n] ~= CoOrd(cX, cY); But to get the expected values, I need to access them like this example for last x co-ord of last item: int xx = pathList[NumPaths

Re: Array declaration warning

2015-06-03 Thread Paul via Digitalmars-d-learn
On Wednesday, 3 June 2015 at 11:42:35 UTC, Paul wrote: the concept is simple enough... Well I thought it was; everything works as expected but I need to access values in the c style, i.e g the definitions: struct CoOrd { int x, y; } CoOrd[][NumPaths]pathList;

Re: Array declaration warning

2015-06-03 Thread Paul via Digitalmars-d-learn
On Wednesday, 3 June 2015 at 02:41:01 UTC, Dennis Ritchie wrote: Actually, I have a small question. And what is the advantage of indexing arrays D-style in front of a C-style arrays? Because C-style indexing is much more familiar: first, we point line, and then the columns. That's what I mean

Re: Array declaration warning

2015-06-02 Thread Dennis Ritchie via Digitalmars-d-learn
I used to not even notice that if D declare an array in C-style, and then indexing it will also in C-style :) Actually, I have a small question. And what is the advantage of indexing arrays D-style in front of a C-style arrays? Because C-style indexing is much more familiar: first, we point line

Re: Array declaration warning

2015-06-02 Thread Steven Schveighoffer via Digitalmars-d-learn
On 6/2/15 9:43 PM, Mike Parker wrote: On 6/3/2015 1:37 AM, Paul wrote: On Tuesday, 2 June 2015 at 16:23:32 UTC, Adam D. Ruppe wrote: On Tuesday, 2 June 2015 at 16:17:23 UTC, Paul wrote: CoOrd[NumPaths][] pathList; Try CoOrd[][NumPaths]. The order is opposite in D style than in C style (I th

Re: Array declaration warning

2015-06-02 Thread Mike Parker via Digitalmars-d-learn
On 6/3/2015 1:37 AM, Paul wrote: On Tuesday, 2 June 2015 at 16:23:32 UTC, Adam D. Ruppe wrote: On Tuesday, 2 June 2015 at 16:17:23 UTC, Paul wrote: CoOrd[NumPaths][] pathList; Try CoOrd[][NumPaths]. The order is opposite in D style than in C style (I thnk the D style makes more sense, it jus

Re: Array declaration warning

2015-06-02 Thread Paul via Digitalmars-d-learn
On Tuesday, 2 June 2015 at 16:23:32 UTC, Adam D. Ruppe wrote: On Tuesday, 2 June 2015 at 16:17:23 UTC, Paul wrote: CoOrd[NumPaths][] pathList; Try CoOrd[][NumPaths]. The order is opposite in D style than in C style (I thnk the D style makes more sense, it just reads one direction, but it do

Re: Array declaration warning

2015-06-02 Thread Paul via Digitalmars-d-learn
On Tuesday, 2 June 2015 at 16:22:58 UTC, Alex Parrill wrote: On Tuesday, 2 June 2015 at 16:17:23 UTC, Paul wrote: This array of structures... CoOrd pathList[NumPaths][]; generates a warning when compiled with DMD 32 bit -w flag, but not 64 bit. This gives me a warning using rdmd on x64 XUbu

Re: Array declaration warning

2015-06-02 Thread Alex Parrill via Digitalmars-d-learn
On Tuesday, 2 June 2015 at 16:17:23 UTC, Paul wrote: This array of structures... CoOrd pathList[NumPaths][]; generates a warning when compiled with DMD 32 bit -w flag, but not 64 bit. This gives me a warning using rdmd on x64 XUbuntu. If I correct the declaration to 'D style' CoOrd[NumPat

Re: Array declaration warning

2015-06-02 Thread Adam D. Ruppe via Digitalmars-d-learn
On Tuesday, 2 June 2015 at 16:17:23 UTC, Paul wrote: CoOrd[NumPaths][] pathList; Try CoOrd[][NumPaths]. The order is opposite in D style than in C style (I thnk the D style makes more sense, it just reads one direction, but it does index differently than you're used to in C)

Array declaration warning

2015-06-02 Thread Paul via Digitalmars-d-learn
This array of structures... CoOrd pathList[NumPaths][]; generates a warning when compiled with DMD 32 bit -w flag, but not 64 bit. If I correct the declaration to 'D style' CoOrd[NumPaths][] pathList; It compiles without warning but I cannot append items to the array like this... pathLis