Re: assertNotThrown (and asserts in general)

2018-05-23 Thread Malte via Digitalmars-d-learn
On Monday, 21 May 2018 at 19:44:17 UTC, Jonathan M Davis wrote: Walter wants to use assertions to then have the compiler make assumptions about the code and optimized based on it, but he hasn't implemented anything like that, and there are a number of arguments about why it's a very bad idea -

Re: assertNotThrown (and asserts in general)

2018-05-21 Thread Jonathan M Davis via Digitalmars-d-learn
On Monday, May 21, 2018 12:44:21 Malte via Digitalmars-d-learn wrote: > I was interested by asserts and how the compiler uses them to > optimize the code. So I looked at the compiler explorer to see > how and found it, it doesn't. > > What I tried to do is turn a std.conv.to!ulong(byte) to a

assertNotThrown (and asserts in general)

2018-05-21 Thread Malte via Digitalmars-d-learn
I was interested by asserts and how the compiler uses them to optimize the code. So I looked at the compiler explorer to see how and found it, it doesn't. What I tried to do is turn a std.conv.to!ulong(byte) to a simple cast with the help of assertions. https://godbolt.org/g/4uckWU If there