[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #47759] scanf should return min/max value on i
From: |
Markus Mützel |
Subject: |
[Octave-bug-tracker] [bug #47759] scanf should return min/max value on integer range overflow |
Date: |
Sat, 23 Apr 2016 08:54:16 +0000 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:46.0) Gecko/20100101 Firefox/46.0 |
Follow-up Comment #1, bug #47759 (project octave):
Matlab does not emit an error message on integer overflow:
>> format long
>> [x, count, errmsg] = sscanf('9999999999', '%d')
x =
2.147483647000000e+09
count =
1
errmsg =
''
>> [x, count, errmsg] = sscanf('fffffffff', '%x')
x =
4.294967295000000e+09
count =
1
errmsg =
''
For completeness, the same for "%ld" and %lx":
>> [x, count, errmsg] = sscanf('9999999999999999999', '%ld')
x =
9223372036854775807
count =
1
errmsg =
''
>> [x, count, errmsg] = sscanf('fffffffffffffffff', '%lx')
x =
18446744073709551615
count =
1
errmsg =
''
No error message either.
Maybe, mark the respective place in the code anyway stating this is Matlab's
behavior. When this would be possible in the future, one might want to emit an
error message anyway?
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?47759>
_______________________________________________
Nachricht gesendet von/durch Savannah
http://savannah.gnu.org/