On 3/2/18 1:21 PM, Jonathan M Davis wrote:
On Friday, March 02, 2018 11:25:00 Steven Schveighoffer via Digitalmars-d
wrote:
Yes, I think assertions should be kept in @safe code. It's weird to have
array bounds checks kept, but not assertions (which is how you would do
equivalent bounds checks in
On Friday, March 02, 2018 11:25:00 Steven Schveighoffer via Digitalmars-d
wrote:
> Yes, I think assertions should be kept in @safe code. It's weird to have
> array bounds checks kept, but not assertions (which is how you would do
> equivalent bounds checks in a custom type).
Then just don't compi
On 3/2/18 10:26 AM, Timon Gehr wrote:
On 02.03.2018 16:05, Steven Schveighoffer wrote:
On 3/2/18 10:00 AM, Timon Gehr wrote:
On 02.03.2018 15:39, Steven Schveighoffer wrote:
In this interpetation, -noboundscheck switches DMD to a different
dialect of D. In that dialect, out-of-bounds access
On 03/02/2018 03:39 PM, Steven Schveighoffer wrote:
On 3/1/18 5:27 PM, ag0aep6g wrote:
[...]
No, I'm looking at the source code.
At the very basic level, you have this:
assert(foo == 0);
Or whatever other condition you have. What this does is gives the
compiler leeway to ASSUME foo is 0 at
On 02.03.2018 16:05, Steven Schveighoffer wrote:
On 3/2/18 10:00 AM, Timon Gehr wrote:
On 02.03.2018 15:39, Steven Schveighoffer wrote:
In this interpetation, -noboundscheck switches DMD to a different
dialect of D. In that dialect, out-of-bounds accesses (and
overlapping copies, apparently
On 02.03.2018 15:39, Steven Schveighoffer wrote:
In this interpetation, -noboundscheck switches DMD to a different
dialect of D. In that dialect, out-of-bounds accesses (and overlapping
copies, apparently) always have UB, in both @system and @safe code.
That defeats the purpose of @safe. Whi
On 3/2/18 10:00 AM, Timon Gehr wrote:
On 02.03.2018 15:39, Steven Schveighoffer wrote:
In this interpetation, -noboundscheck switches DMD to a different
dialect of D. In that dialect, out-of-bounds accesses (and
overlapping copies, apparently) always have UB, in both @system and
@safe code.
On 3/1/18 5:27 PM, ag0aep6g wrote:
You're looking at the behavior of the compiled executable. Then it makes
sense to say that a program compiled with the checks has defined
behavior (throwing Errors) and a program without the checks does
something undefined (because the compiler manual doesn't
On 3/2/18 3:36 AM, Daniel Kozak wrote:
I do not know, but from my experience it is good at it. I have done many
benchmarks for plenty of code, and in recent D
compilers -boundscheck=off does not improve speed. To be fair
using -boundscheck=off make D code slower in many cases, which is wierd
b
I do not know, but from my experience it is good at it. I have done many
benchmarks for plenty of code, and in recent D compilers -boundscheck=off
does not improve speed. To be fair using -boundscheck=off make D code
slower in many cases, which is wierd but true.
On Fri, Mar 2, 2018 at 8:48 AM, Na
On Thursday, 1 March 2018 at 21:01:08 UTC, Steven Schveighoffer
wrote:
Yeah, it seems like -noboundscheck should never be used.
How good is DMD at omitting redundant bounds checks? I assume not
much engineering effort has been put towards that due to
"-boundscheck=off" being available.
On Thursday, 1 March 2018 at 21:01:08 UTC, Steven Schveighoffer
wrote:
Yeah, it seems like -noboundscheck should never be used.
Agreed.
It's undefined behavior if the check is disabled. How you get
the check disabled may be affected by @safe, but whether it's
UB or not has nothing to do with
On Thursday, March 01, 2018 16:01:08 Steven Schveighoffer via Digitalmars-d
wrote:
> On 3/1/18 3:24 PM, ag0aep6g wrote:
> > On Thursday, 1 March 2018 at 20:14:07 UTC, Steven Schveighoffer wrote:
> >> dmd -version=dosafe -noboundscheck -run testarrayoverlap.d => no
> >> error, undefined behavior
>
On 3/1/18 3:24 PM, ag0aep6g wrote:
On Thursday, 1 March 2018 at 20:14:07 UTC, Steven Schveighoffer wrote:
dmd -version=dosafe -noboundscheck -run testarrayoverlap.d => no
error, undefined behavior
dmd -run testarrayoverlap.d => error
@safe has nothing to do with it.
@safe has everything to d
On Thursday, 1 March 2018 at 20:14:07 UTC, Steven Schveighoffer
wrote:
dmd -version=dosafe -noboundscheck -run testarrayoverlap.d =>
no error, undefined behavior
dmd -run testarrayoverlap.d => error
@safe has nothing to do with it.
@safe has everything to do with. @safe guarantees that there'
On 3/1/18 3:06 PM, ag0aep6g wrote:
On Thursday, 1 March 2018 at 19:05:26 UTC, Steven Schveighoffer wrote:
Yes it behaves just like array bounds. No it's not well-defined if you
disable asserts.
Right. So it's defined to throw an Error in @safe code, and it has
undefined behavior in @system co
On Thursday, 1 March 2018 at 19:05:26 UTC, Steven Schveighoffer
wrote:
Yes it behaves just like array bounds. No it's not well-defined
if you disable asserts.
Right. So it's defined to throw an Error in @safe code, and it
has undefined behavior in @system code. The spec should say this.
On 3/1/18 12:31 PM, ag0aep6g wrote:
On Thursday, 1 March 2018 at 17:06:48 UTC, Steven Schveighoffer wrote:
On 3/1/18 11:48 AM, ag0aep6g wrote:
[...]
Does that mean it has undefined behavior and should not be allowed in
@safe code?
No, it means it's a runtime error.
But then it's well-defin
On Thursday, 1 March 2018 at 17:06:48 UTC, Steven Schveighoffer
wrote:
On 3/1/18 11:48 AM, ag0aep6g wrote:
[...]
Does that mean it has undefined behavior and should not be
allowed in @safe code?
No, it means it's a runtime error.
But then it's well-defined, like going beyond array bounds, n
On 3/1/18 11:48 AM, ag0aep6g wrote:
On 03/01/2018 04:34 PM, David Nadlinger wrote:
On Thursday, 1 March 2018 at 14:54:41 UTC, Shachar Shemesh wrote:
I.e. - is it well defined to copy between overlapping slices?
No: https://dlang.org/spec/arrays.html#overlapping-copying
Does that mean it has
On 03/01/2018 04:34 PM, David Nadlinger wrote:
On Thursday, 1 March 2018 at 14:54:41 UTC, Shachar Shemesh wrote:
I.e. - is it well defined to copy between overlapping slices?
No: https://dlang.org/spec/arrays.html#overlapping-copying
Does that mean it has undefined behavior and should not be
On Thursday, 1 March 2018 at 14:54:41 UTC, Shachar Shemesh wrote:
I.e. - is it well defined to copy between overlapping slices?
No: https://dlang.org/spec/arrays.html#overlapping-copying
—David
a[0..10][] = a[5..15][];
I.e. - is it well defined to copy between overlapping slices? Does it
matter if, in the copy, the source is overlapping the end or the
beginning of the destination?
23 matches
Mail list logo