bcc icon indicating copy to clipboard operation
bcc copied to clipboard

Optionally warn of data loss

Open GWRon opened this issue 3 years ago • 1 comments

Assume you have a function accepting "long" and you want to manually pass a value.

SuperStrict
Framework Brl.StandardIO

Function MyFunc:Long(p:Long)
  Return p
End Function

Print MyFunc($12345600000654321:Long)
Print MyFunc($12345600000654321)

If MyFunc($12345600000654321:Long) = MyFunc($12345600000654321)
	Print "equal"
Else
	Print "not equal"
EndIf

Output is:

2541543117843415841
2541543113548448545
not equal

BCC should possibly detect the "size/detail" of a passed value - and then decide if to really default to int/float, or if a long/double would fit better. Or at least print out a warning, that the second call (the one without ":long") leads to potential data loss (as it is understood as an "int" here)

GWRon avatar Dec 21 '21 08:12 GWRon