EPICS Home

Experimental Physics and Industrial Control System


 
2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: epicsStr[n]CaseCmp()
From: Andrew Johnson <[email protected]>
To: EPICS core-talk <[email protected]>
Date: Mon, 10 Mar 2014 17:03:06 -0500
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  <20142015  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  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024