Re: dub segfault and range error handling

2021-09-16 Thread jfondren via Digitalmars-d-learn
On Thursday, 16 September 2021 at 20:49:28 UTC, seany wrote: I compile with : `dub build -b release --compiler=ldc2` The result executing the compiled binary 'myproj' is is ( whether `writeln (a[1])` is uncommented, or the `test()` function is uncommented) some random number, usually negativ

Re: dub segfault and range error handling

2021-09-16 Thread seany via Digitalmars-d-learn
On Thursday, 16 September 2021 at 20:49:28 UTC, seany wrote: I create a new project with : `dub init myproj`. Then I change the source/app.d file with this : [...] PS :compiling with : `dub build -b release ` ( i.e. no ldc2) is a direct segfault of the code posted above. PPS : my system is

dub segfault and range error handling

2021-09-16 Thread seany via Digitalmars-d-learn
I create a new project with : `dub init myproj`. Then I change the source/app.d file with this : ` import std.stdio; import std.math; import std.stdio; import std.conv; import std.format; import std.math; import std.algorithm;

Re: Range Error

2021-04-15 Thread martinm via Digitalmars-d-learn
On Sunday, 11 April 2021 at 19:48:42 UTC, Ruby The Roobster wrote: On Sunday, 11 April 2021 at 19:45:30 UTC, Ruby The Roobster wrote: What am I doing wrong here? Is it the 'for' loop? Nevermind. I messed up what line it was. It was actually this line: ```d square[i][j] = new Square(Color.non

Re: Range Error

2021-04-12 Thread Imperatorn via Digitalmars-d-learn
On Monday, 12 April 2021 at 19:19:12 UTC, kdevel wrote: On Monday, 12 April 2021 at 18:13:38 UTC, Imperatorn wrote: [...] [...] D can be so much fun! ```d import std.stdio; [...] Of course :D

Re: Range Error

2021-04-12 Thread kdevel via Digitalmars-d-learn
On Monday, 12 April 2021 at 18:13:38 UTC, Imperatorn wrote: [...] Yup D can be so much fun! ```d import std.stdio; enum Color {none = " n ", red = " r ", black = " b "}; enum sColor {black= " b ", white= " w "}; class Square { public: this(Color color, sColor Scolor) { this.color

Re: Range Error

2021-04-12 Thread Imperatorn via Digitalmars-d-learn
On Monday, 12 April 2021 at 18:01:02 UTC, kdevel wrote: On Sunday, 11 April 2021 at 20:41:35 UTC, Bastiaan Veelo wrote: [...] [...] Yes, there is a `7` where there should be an `i` on this line: ```d for(int i=7;7>=0;i--) ``` This will go on forever, so you get a range error as soon as

Re: Range Error

2021-04-12 Thread kdevel via Digitalmars-d-learn
On Sunday, 11 April 2021 at 20:41:35 UTC, Bastiaan Veelo wrote: [...] What am I doing wrong here? Is it the 'for' loop? Yes, there is a `7` where there should be an `i` on this line: ```d for(int i=7;7>=0;i--) ``` This will go on forever, so you get a range error as so

Re: Range Error

2021-04-12 Thread Ruby The Roobster via Digitalmars-d-learn
this line: ```d   for(int i=7;7>=0;i--) ``` This will go on forever, so you get a range error as soon as `i < 0`. ... I fixed the code now. It works. Thanks for your help.

Re: Range Error

2021-04-12 Thread Ruby The Roobster via Digitalmars-d-learn
is will go on forever, so you get a range error as soon as `i < 0`. —Bastiaan. I have fixed this.

Re: Range Error

2021-04-11 Thread Steven Schveighoffer via Digitalmars-d-learn
so you get a range error as soon as `i < 0`. Also this code is wrong: ```d for(int i=2;i>=0;i--) { for(int j=7;i>=0;j--) ``` For that j loop, i will always be 2, so it will not terminate until the range error happens. Should probably be: for(int j=7; j >= 0; j--)

Re: Range Error

2021-04-11 Thread Bastiaan Veelo via Digitalmars-d-learn
On Sunday, 11 April 2021 at 19:45:30 UTC, Ruby The Roobster wrote: What am I doing wrong here? Is it the 'for' loop? Yes, there is a `7` where there should be an `i` on this line: ```d for(int i=7;7>=0;i--) ``` This will go on forever, so you get a range error as so

Re: Range Error

2021-04-11 Thread Ruby The Roobster via Digitalmars-d-learn
On Sunday, 11 April 2021 at 19:45:30 UTC, Ruby The Roobster wrote: What am I doing wrong here? Is it the 'for' loop? Nevermind. I messed up what line it was. It was actually this line: ```d square[i][j] = new Square(Color.none, sColor.white); ```

Range Error

2021-04-11 Thread Ruby The Roobster via Digitalmars-d-learn
So, here is the full code: ```d enum Color {none=0,red=1,black=2}; enum sColor {black=0,white=1}; class Square { public: this(Color color, sColor Scolor) { this.color = color; this.Scolor = Scolor; } Color color; sColor Scolor; } import std.stdio; void cPrintboard(Square[8

Re: Error 16: Index Range error while building examples from D Web development

2017-09-17 Thread Nicholas Wilson via Digitalmars-d-learn
On Sunday, 17 September 2017 at 11:42:16 UTC, kerdemdemir wrote: Hi, Thanks its price dropped to 10 Euros I bought the the D Web Development book and I were trying to build some examples. The example in Chapter3 called noteapp4 is giving me this error : [...] Optlink bug I guess? try usin

Error 16: Index Range error while building examples from D Web development

2017-09-17 Thread kerdemdemir via Digitalmars-d-learn
. Linking... OPTLINK (R) for Win32 Release 8.00.17 Copyright (C) Digital Mars 1989-2013 All rights reserved. http://www.digitalmars.com/ctg/optlink.html .dub\build\application-debug-windows-x86-dmd_2075-102ED5AC10E8F023CF2D8D690787ADD9\noteapp4.obj(noteapp4) Offset 23F7EH Record Type 009D E