Unexpected path of execution

Charles Hixson charleshixsn at earthlink.net
Tue Oct 19 16:20:39 UTC 2021

given this code fragment:

             if    (i < (line.length - 3) )
             {    writeln ("in c4: i = ", i, ", line.length = ", 
                   add2 (c4, line [i..i+4]);
I get this result:

in c4: i = 0, line.length = 2
core.exception.RangeError at source/freqs.d(32): Range violation
??:? _d_arrayboundsp [0x56041325a70d]
??:? _Dmain [0x560413233beb]

Why did this get executed?  The if test was supposed to prevent this.

DMD64 D Compiler v2.097.2

Javascript is what you use to allow third part programs you don't know anything about and doing you know not what to run on your computer.

More information about the Digitalmars-d-learn mailing list