Tagged Questions
10
votes
6answers
1k views
Should I use unsigned integers for counting members?
Should I use unsigned integers for my count class members?
Answer
For example, assume a class
TList <T> = class
private
FCount : Cardinal;
public
property Count : Cardinal read FCount;
...
6
votes
4answers
1k views
Delphi: How to avoid EIntOverflow underflow when subtracting?
Microsoft already says, in the documentation for GetTickCount, that you could never compare tick counts to check if an interval has passed. e.g.:
Incorrect (pseudo-code):
DWORD endTime = ...
4
votes
1answer
1k views
Delphi: How do i use $OVERFLOWCHECKS OFF to disable overflow checks?
i have bit of code that causes an underflow:
var
t1, t2, delta: DWORD:
begin
t1 := 0xffffff00;
t2 := 0x00000037;
delta := (t2 - t1);
The subtraction itself does generate an overflow ...