[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #54373] strncmp does not compute result accura
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #54373] strncmp does not compute result accurately when N exceeds string length |
Date: |
Wed, 25 Jul 2018 12:05:08 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0 |
Update of bug #54373 (project octave):
Item Group: Matlab Compatibility => Incorrect Result
Status: None => Confirmed
Operating System: Mac OS => Any
Summary: Different behavior of strncmp compared to Matlab =>
strncmp does not compute result accurately when N exceeds string length
_______________________________________________________
Follow-up Comment #1:
Confirmed.
Very simple test is
octave:2> strncmp ('abc', 'abc', 3)
ans = 1
octave:3> strncmp ('abc', 'abc', 4)
ans = 0
This shouldn't be hard to fix. I seem to remember that Octave tries to avoid
calling the C library function strncmp by checking obvious things, like
whether the length of the strings are equal. In this case, it must be
comparing the string length to the number of characters, N, which is
incorrect.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?54373>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
- [Octave-bug-tracker] [bug #54373] Different behavior of strncmp compared to Matlab, Arnaud Delorme, 2018/07/25
- [Octave-bug-tracker] [bug #54373] strncmp does not compute result accurately when N exceeds string length,
Rik <=
- [Octave-bug-tracker] [bug #54373] strncmp does not compute result accurately when N exceeds string length, Rik, 2018/07/25
- [Octave-bug-tracker] [bug #54373] strncmp does not compute result accurately when N exceeds string length, Rik, 2018/07/25
- [Octave-bug-tracker] [bug #54373] strncmp does not compute result accurately when N exceeds string length, Rik, 2018/07/25
- [Octave-bug-tracker] [bug #54373] strncmp does not compute result accurately when N exceeds string length, Philip Nienhuis, 2018/07/25
- [Octave-bug-tracker] [bug #54373] strncmp does not compute result accurately when N exceeds string length, Rik, 2018/07/25
- [Octave-bug-tracker] [bug #54373] strncmp does not compute result accurately when N exceeds string length, Rik, 2018/07/27
- [Octave-bug-tracker] [bug #54373] strncmp does not compute result accurately when N exceeds string length, Philip Nienhuis, 2018/07/27
- [Octave-bug-tracker] [bug #54373] strncmp does not compute result accurately when N exceeds string length, Rik, 2018/07/27
- [Octave-bug-tracker] [bug #54373] strncmp does not compute result accurately when N exceeds string length, Rik, 2018/07/28