digitalmars.D - dynamic multidimensional arrays
- Ald (6/6) Sep 05 2005 Hello. I just started to learn the language.
- =?ISO-8859-1?Q?Jari-Matti_M=E4kel=E4?= (5/15) Sep 05 2005 You can use a simple foreach-loop:
- Ald (4/8) Sep 05 2005 Thank you, it works now.
- David L. Davis (15/17) Sep 05 2005 Ald,
- John Reimer (6/21) Sep 05 2005 It's good practice to respond with a thanks or otherwise because it
- =?utf-8?B?RGF3aWQgQ2nEmcW8YXJraWV3aWN6?= (5/16) Sep 06 2005 Not a big deal, but you probably want to know that there is `D.learn' li...
- Stefan (29/36) Sep 06 2005 Strange, it doesn't work for me (DMD 0.129, Win XP).
- Stefan (17/54) Sep 06 2005 I think it should be (note the "inout)":
- Regan Heath (4/62) Sep 06 2005 I think so.
- Victor Nakoryakov (20/30) Sep 06 2005 In this statement you do following:
Hello. I just started to learn the language. Now, I am trying to use a dynamic two-dimensional array. The compiler accepted the following line without a problem: picture.length = (width), (height); However, running the binary resulst in Win32 exception error. I have read the manual and the forum for an hour or so, but found no answer.
Sep 05 2005
Ald wrote:Hello. I just started to learn the language. Now, I am trying to use a dynamic two-dimensional array. The compiler accepted the following line without a problem: picture.length = (width), (height); However, running the binary resulst in Win32 exception error. I have read the manual and the forum for an hour or so, but found no answer.You can use a simple foreach-loop: int[][] table table.length = height; foreach(int[] row; table) row.length = width;
Sep 05 2005
You can use a simple foreach-loop: int[][] table table.length = height; foreach(int[] row; table) row.length = width;Thank you, it works now. ... Do you expect people to thank for advice or do you consider it to be unnecessary and redundant messages on the board?
Sep 05 2005
In article <dfigu9$2lj1$1 digitaldaemon.com>, Ald says...Do you expect people to thank for advice or do you consider it to be unnecessary and redundant messages on the board?Ald, My thoughts are, "If the question you asked was important enough to post for others to read, and then someone took the time to reply back to you with some very helpful information...wouldn't posting a thanks be the right thing to do?" And as far as I know, this forum doesn't have a rule to whether it's necessary or not to post a thanks, it's lefted up to each person to decide. But just because we're on the web, it doesn't mean we can forget our manners. Afterall, this is an International Community, plus "these posts may be the only way other people can discover who you are...so be mindful." :) David L. ------------------------------------------------------------------- "Dare to reach for the Stars...Dare to Dream, Build, and Achieve!" ------------------------------------------------------------------- MKoD: http://spottedtiger.tripod.com/D_Language/D_Main_XP.html
Sep 05 2005
Ald wrote:It's good practice to respond with a thanks or otherwise because it let's the other person know that their suggestion was useful in solving your problem. Feedback is almost always a good idea. -JJRYou can use a simple foreach-loop: int[][] table table.length = height; foreach(int[] row; table) row.length = width;Thank you, it works now. ... Do you expect people to thank for advice or do you consider it to be unnecessary and redundant messages on the board?
Sep 05 2005
On Tue, 06 Sep 2005 00:30:34 +0200, Ald <Ald_member pathlink.com> wrote:Not a big deal, but you probably want to know that there is `D.learn' list where probably-simple-to-answer questions should be send. -- Dawid CiężarkiewiczYou can use a simple foreach-loop: int[][] table table.length = height; foreach(int[] row; table) row.length = width;Thank you, it works now. ... Do you expect people to thank for advice or do you consider it to be unnecessary and redundant messages on the board?
Sep 06 2005
In article <dfigu9$2lj1$1 digitaldaemon.com>, Ald says...Strange, it doesn't work for me (DMD 0.129, Win XP). throws ArrayBoundsError. What works for me is: Kind regards, StefanYou can use a simple foreach-loop: int[][] table table.length = height; foreach(int[] row; table) row.length = width;Thank you, it works now.
Sep 06 2005
In article <dfl79t$1u38$1 digitaldaemon.com>, Stefan says...In article <dfigu9$2lj1$1 digitaldaemon.com>, Ald says...I think it should be (note the "inout)": Am I right? Regards, StefanStrange, it doesn't work for me (DMD 0.129, Win XP). throws ArrayBoundsError. What works for me is:You can use a simple foreach-loop: int[][] table table.length = height; foreach(int[] row; table) row.length = width;Thank you, it works now.
Sep 06 2005
On Tue, 6 Sep 2005 23:15:49 +0000 (UTC), Stefan <Stefan_member pathlink.com> wrote:In article <dfl79t$1u38$1 digitaldaemon.com>, Stefan says...I think so. ReganIn article <dfigu9$2lj1$1 digitaldaemon.com>, Ald says...I think it should be (note the "inout)": Am I right?Strange, it doesn't work for me (DMD 0.129, Win XP). throws ArrayBoundsError. What works for me is:You can use a simple foreach-loop: int[][] table table.length = height; foreach(int[] row; table) row.length = width;Thank you, it works now.
Sep 06 2005
Ald wrote:Hello. I just started to learn the language. Now, I am trying to use a dynamic two-dimensional array. The compiler accepted the following line without a problem: picture.length = (width), (height); However, running the binary resulst in Win32 exception error. I have read the manual and the forum for an hour or so, but found no answer.In this statement you do following: "assign to picture's length result of comma expression". result of comma expression is result of rightmost expression among expressions separated by comma. So in other words you wrote equivalent to: picture.length = height; Exception is consequence of value of `height`, I think it was negative. For me following snipet compiles and runs as expected: module core; void main() { uint width = 5; uint height = 15; int[][] a; a.length = (width), (height); } -- Victor (aka nail) Nakoryakov nail-mail<at>mail<dot>ru Krasnoznamensk, Moscow, Russia
Sep 06 2005