-
-
Notifications
You must be signed in to change notification settings - Fork 45
Open
Description
There are no overflow exceptions thrown at runtime when numbers overflow by arithmetic operations, even if /ovf is enabled.
NOTE: Fixing this might cause problems in the X# runtime or user code that accidentally depends on this behavior. So we need to be very careful about fixing this and test a lot. Just logging it so it is not forgotten, but something to be looked at in the future, not now!!!
#pragma options (ovf,on)
#pragma options (fovf,on)
FUNCTION Start() AS VOID
LOCAL dw AS DWORD
LOCAL n AS INT
dw := 1
dw -= 2 // no exception
? dw:ToString()
n := Int32.MaxValue
n ++ // no exception
? n:ToString()
// this one does thrown an overflow exception
// n := -1
// dw := (DWORD) n
BEGIN CHECKED
dw := 1
// dw -= 2 // withing a CHECKED section, overflow exception does get thrown
END CHECKED
Reactions are currently unavailable