On Wednesday, 16 March 2016 at 18:39:36 UTC, Mathias Lang wrote:
Sadly, to solve that without imposing much pain on the users,
you need a more decent VRP than we currently have,
I just read Walter's Dr. Dobbs article on VRP:
http://www.drdobbs.com/tools/value-range-propagation/229300211
On Wednesday, 16 March 2016 at 16:40:49 UTC, Shachar Shemesh
wrote:
Please consider the following program, which is a reduced
version of a problem I've spent the entire of today trying to
debug:
import std.stdio;
void main() {
enum ulong MAX_VAL = 256;
long value = -500;
if(
On Wednesday, 16 March 2016 at 16:40:49 UTC, Shachar Shemesh
wrote:
...
People who are marginally familiar with integer promotion will
not be surprised to know that the program prints "256". What is
surprising to me is that this produced neither error nor
warning.
The comparable program in
On Thursday, 17 March 2016 at 09:13:34 UTC, tsbockman wrote:
You could use the `DebugInt` wrapper. It aliases to `SafeInt`
in debug and unittest mode, to find problems (many, including
the specific one in this thread, are detected at compile time).
Then, in release mode, it aliases to the
On Thursday, 17 March 2016 at 12:35:27 UTC, Basile B wrote:
import std.traits;
bool safeIntegralCmp(string op, L, R)(auto ref L lhs, auto ref
R rhs)
if (isIntegral!R && isIntegral!L)
{
// safe
static if (is(Unqual!L == Unqual!R))
{
mixin("return lhs" ~ op ~ "rhs;");
}
On Thursday, 17 March 2016 at 09:13:34 UTC, tsbockman wrote:
On Thursday, 17 March 2016 at 06:55:34 UTC, Shachar Shemesh
wrote:
On 16/03/16 23:50, tsbockman wrote:
On Wednesday, 16 March 2016 at 16:40:49 UTC, Shachar Shemesh
wrote:
...
People who are marginally familiar with integer
On Wednesday, 16 March 2016 at 16:40:49 UTC, Shachar Shemesh
wrote:
Please consider the following program, which is a reduced
version of a problem I've spent the entire of today trying to
debug:
import std.stdio;
void main() {
enum ulong MAX_VAL = 256;
long value = -500;
if(
On Thursday, 17 March 2016 at 09:59:41 UTC, Dominikus Dittes
Scherkl wrote:
Or you can use an improved opCmp implementation in the
compiler, that only add additional runtime cost, [...]
The compiler could statically fix two cases, ALWAYS without
runtime cost. I think that FPC does this:
On Wednesday, 16 March 2016 at 16:40:49 UTC, Shachar Shemesh
wrote:
People who are marginally familiar with integer promotion will
not be surprised to know that the program prints "256". What is
surprising to me is that this produced neither error nor
warning.
Here's a simpler example:
On Thursday, 17 March 2016 at 09:59:41 UTC, Dominikus Dittes
Scherkl wrote:
Or you can use an improved opCmp implementation in the
compiler, that only add additional runtime cost, if someone is
stupid enough to compare signed with unsigned values - but
yield the correct result:
I should also
Please consider the following program, which is a reduced version of a
problem I've spent the entire of today trying to debug:
import std.stdio;
void main() {
enum ulong MAX_VAL = 256;
long value = -500;
if( value>MAX_VAL )
value = MAX_VAL;
writeln(value);
}
People
https://issues.dlang.org/show_bug.cgi?id=259
On Thursday, 17 March 2016 at 06:55:34 UTC, Shachar Shemesh wrote:
On 16/03/16 23:50, tsbockman wrote:
On Wednesday, 16 March 2016 at 16:40:49 UTC, Shachar Shemesh
wrote:
...
People who are marginally familiar with integer promotion
will not be
surprised to know that the program prints
On 16/03/16 23:50, tsbockman wrote:
On Wednesday, 16 March 2016 at 16:40:49 UTC, Shachar Shemesh wrote:
...
People who are marginally familiar with integer promotion will not be
surprised to know that the program prints "256". What is surprising to
me is that this produced neither error nor
On Thursday, 17 March 2016 at 09:59:41 UTC, Dominikus Dittes
Scherkl wrote:
Or you can use an improved opCmp implementation in the
compiler, that only add additional runtime cost, if someone is
stupid enough to compare signed with unsigned values - but
yield the correct result:
For the
On Wednesday, 16 March 2016 at 18:39:36 UTC, Mathias Lang wrote:
Sadly, to solve that without imposing much pain on the users,
you need a more decent VRP than we currently have...
Lionello Lunesu did a lot of work both on improving VRP, and on
bug 259:
16 matches
Mail list logo