epicsStringTest.c currently proves (amongst other things) that
testOk1(epicsStrnCaseCmp(" ", "", 1) < 0);
testOk1(epicsStrnCaseCmp("", " ", 1) > 0);
testOk1(epicsStrnCaseCmp("abcd", "ABCDE", 1000) > 0);
testOk1(epicsStrnCaseCmp("abcde", "ABCD", 1000) < 0);
testOk1(epicsStrCaseCmp("abcd", "ABCDE") != 0);
testOk1(epicsStrCaseCmp("abcde", "ABCD") != 0);
testOk1(epicsStrCaseCmp("abcde", "ABCDF") != 0);
Unfortunately the first group are wrong, and glibc's str[n]casecmp()
functions on RHEL6 agree with me. Longer strings should always compare
greater than any initial subset of themselves. The second group probably
uses != because the author didn't want to think about and fix the bug at
the time...
Any comments?
- Andrew
--
Advertising may be described as the science of arresting the human
intelligence long enough to get money from it. -- Stephen Leacock
- Replies:
- Re: epicsStr[n]CaseCmp() Benjamin Franksen
- Navigate by Date:
- Prev:
[Merge] lp:~anj/epics-base/cas-intf-addr-list into lp:epics-base Andrew Johnson
- Next:
Re: epicsStr[n]CaseCmp() Benjamin Franksen
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
<2014>
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
[Merge] lp:~anj/epics-base/cas-intf-addr-list into lp:epics-base Andrew Johnson
- Next:
Re: epicsStr[n]CaseCmp() Benjamin Franksen
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
<2014>
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|