Skip to content

Commit b582bd7

Browse files
committed
Show only expressions tracked, not variables; add wikipedia link
1 parent 093b61a commit b582bd7

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

spec/type.dd

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,17 @@ $(H3 $(LNAME2 vrp, Value Range Propagation))
373373
s = b + b; // OK, 0 ... b.max + b.max
374374
---
375375
)
376-
$(P For more information, see $(LINK2 https://digitalmars.com/articles/b62.html, here).)
376+
$(P Note the implementation does not track the range of possible values for variables,
377+
only expressions:)
378+
---
379+
extern int i;
380+
short s = i & 0xff; // OK
381+
// s is now assumed to be s.min ... s.max, not 0 ... 0xff
382+
//byte b = s; // error
383+
byte b = s & 0xff; // OK
384+
---
385+
* For more information, see $(LINK2 https://digitalmars.com/articles/b62.html, the dmc article).
386+
* See also: $(LINK https://en.wikipedia.org/wiki/Value_range_analysis).
377387

378388

379389
$(H2 $(LNAME2 bool, $(D bool)))

0 commit comments

Comments
 (0)