1 matches bool, 2 matches long

H. S. Teoh hsteoh at quickfur.ath.cx
Fri Apr 26 17:14:33 PDT 2013


On Fri, Apr 26, 2013 at 08:05:45PM -0400, Jonathan M Davis wrote:
> On Friday, April 26, 2013 14:34:45 Walter Bright wrote:
> > D has an interesting feature called VRP (value range propagation), where
> > implicit conversion very much depends on the value.
> 
> VRP is a fantastic feature, but I think that it's coming back to bite us 
> somewhat if foo(1) calls an overload which takes bool.
[...]

Does VRP work only with literals, or does it work with general variables
(by inferring from, say, if-conditions)?

	void func(int i) {
		ubyte b;
		if (i >= 0 && i < 256) {
			b = i;		// OK without cast?
		}
		...
	}


T

-- 
That's not a bug; that's a feature!


More information about the Digitalmars-d mailing list