Oh I see.. it does work on DWord.. I was testing it with constants: Writeln($FFFFFFFE+$00000006); But I think the compiler resolved this so it would never create a overflow error.. When I do it with variables now I get the overflow and I can control it with {$Q-} and {$Q+}
Is there some way I can do {$Q-} before my check then restore it to whatever it was before after it? (for example if it was already set to {$Q-} in the compiler, I would not want to turn it back on) Is there a way to do a temporary override for the one line? I'm trying to figure out how to make a generic function for this that will work regardless of what is set in the compiler without changing the rest of the program. I Thought I could put the result into a Qword then just AND it with $FFFFFFFF and put that into my DWord... that seems like it would make it work even if overflow checking was on... But when I tried this with a little sample program, I still got the runtime error 215... I don't know why, because I was putting the answer into a Qword. var num1,num2:dword; QWresult:Qword; DWresult:Dword; begin num1:=8; num2:=$FFFFFFFE; QWresult:=QWord(num1+num2); //Generates runtime 215 DWresult:=(QWresult AND $00000000FFFFFFFF); writeln(DWresult); end. But if I do QWresult:=(QWord(num1)+QWord(num2)); It does not So I'm wondering why QWresult:=QWord(num1+num2); Did not work as I expected it to. James _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal