The following:
import std.stdio;
void main() {
int[5] arg;
arg[10] = 3; // Compiler says (of course): Error:
array index 10 is out of bounds arg[0 .. 5]
}
import std.stdio;
void main() {
int[5] arg;
foreach (i; 0..10) {
arg[i] = i;
}
}
Compiler says nothing, but
On Friday, 23 May 2014 at 15:14:47 UTC, Chris wrote:
The following:
import std.stdio;
void main() {
int[5] arg;
arg[10] = 3; // Compiler says (of course):
Error: array index 10 is out of bounds arg[0 .. 5]
}
import std.stdio;
void main() {
int[5] arg;
foreach (i;
On Friday, 23 May 2014 at 15:14:47 UTC, Chris wrote:
The following:
import std.stdio;
void main() {
int[5] arg;
arg[10] = 3; // Compiler says (of course):
Error: array index 10 is out of bounds arg[0 .. 5]
}
import std.stdio;
void main() {
int[5] arg;
foreach (i;
Chris:
The following:
import std.stdio;
void main() {
int[5] arg;
arg[10] = 3; // Compiler says (of course):
Error: array index 10 is out of bounds arg[0 .. 5]
}
import std.stdio;
void main() {
int[5] arg;
foreach (i; 0..10) {
arg[i] = i;
}
}
Compiler says
There is a way to prevent bounds checking of array accesses when
compiling. I was wondering if there was a way to have a user
defined range apply the same scheme? I'd suppose using a
version? I'm not very fluent with this yet...
On Monday, August 20, 2012 10:43:43 monarch_dodra wrote:
There is a way to prevent bounds checking of array accesses when
compiling. I was wondering if there was a way to have a user
defined range apply the same scheme? I'd suppose using a
version? I'm not very fluent with this yet...
I
On Monday, 20 August 2012 at 09:10:47 UTC, Jonathan M Davis wrote:
On Monday, August 20, 2012 10:43:43 monarch_dodra wrote:
There is a way to prevent bounds checking of array accesses
when
compiling. I was wondering if there was a way to have a user
defined range apply the same scheme? I'd
On Monday, August 20, 2012 11:45:23 monarch_dodra wrote:
On Monday, 20 August 2012 at 09:10:47 UTC, Jonathan M Davis wrote:
On Monday, August 20, 2012 10:43:43 monarch_dodra wrote:
There is a way to prevent bounds checking of array accesses
when
compiling. I was wondering if there was a
On Monday, 20 August 2012 at 09:58:54 UTC, Jonathan M Davis wrote:
I'm not sure that it was ever even considered that the
programmer might want
to do something special with them. assert is affected by
-release, and -
noboundscheck was added later for extra control. They had
nothing to do
On Monday, August 20, 2012 12:44:40 monarch_dodra wrote:
Andrei says something in his book along the lines of If a built
in can do it, so should a user defined type (don't have the
quote here though, sorry). So basically, if a built in array can
conditionally control bounds checking, why can't
On Monday, 20 August 2012 at 15:42:50 UTC, Jonathan M Davis wrote:
On Monday, August 20, 2012 12:44:40 monarch_dodra wrote:
Except that generally assert does the job just fine. The only
reason that -
noboundscheck is any different really is the fact that bounds
checking is left
on in @safe
11 matches
Mail list logo