octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #57879] strncmp(str_a, str_b, N) gives an erro


From: Nicholas Jankowski
Subject: [Octave-bug-tracker] [bug #57879] strncmp(str_a, str_b, N) gives an error for N=0
Date: Fri, 21 Feb 2020 20:37:07 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36

Follow-up Comment #2, bug #57879 (project octave):

and that is spelled out in the matlab help, so this is a documented
compatibility bug


If n is 0, then strncmp always returns 1. By convention, the zeroth character
of a character vector or a string scalar is always '', a 0-by-0 character
array.

If n is less than 0, then strncmp treats it as 0.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?57879>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]