Win32: use _strnicmp (ISO C++) instead of deprecated strnicmp (POSIX) - V2 #1351

pull Diapolo wants to merge 1 commits into bitcoin:master from Diapolo:strnicmp_WIN32_V2 changing 2 files +6 −4
  1. Diapolo commented at 8:08 AM on May 18, 2012: none

    This does things better than the first commit, which had a bug and placed define strncasecmp _strnicmp in an #ifndef WIN32 in init.cpp. Sorry for this.

  2. Win32: use _strnicmp (ISO C++) instead of deprecated strnicmp (POSIX) - V2 39934de4ba
  3. in src/init.cpp:None in 5c367aa2c1 outdated
      13 | @@ -14,6 +14,10 @@
      14 |  #include <boost/filesystem/convenience.hpp>
      15 |  #include <boost/interprocess/sync/file_lock.hpp>
      16 |  
      17 | +#ifdef WIN32
    


    luke-jr commented at 7:54 PM on May 18, 2012:

    Rather move this to an #else under the #ifndef WIN32...


    Diapolo commented at 9:18 PM on May 18, 2012:

    Good point, will do this.

  4. Diapolo commented at 9:21 PM on May 18, 2012: none

    Updated to reflect suggestion from @luke-jr.

  5. gavinandresen commented at 1:08 PM on May 19, 2012: contributor

    NACK. It would be better to get rid of usage of strncasecmp all together and use boost's case-insensitive string support.

    E.g. - if (strlen(argv[i]) > 7 && strncasecmp(argv[i], "bitcoin:", 8) == 0) + if (boost::algorithm::istarts_with(argv[i], "bitcoin:"))

    istarts_with is in boost/algorithm/string/predicate.hpp

  6. Diapolo commented at 10:19 PM on May 19, 2012: none

    @gavinandresen Are you fine with massive boost usage now? I will update that pull and use what you suggested, no problem.

  7. Diapolo commented at 11:02 PM on May 19, 2012: none

    Closed in favor of #1363!

  8. Diapolo closed this on May 19, 2012

  9. gavinandresen commented at 11:16 PM on May 19, 2012: contributor

    RE: "massive boost usage" :

    I'm all for making the code clearer and more cross-platform, and we're dependent on boost anyway. The string algorithms are nice little self-contained pieces of functionality.

    But I'm on the fence for changes like sipa's pull request that uses boost::variant for bitcoin addresses (and requires writing little visitor classes to do simple things). I think template metaprogramming is the wrong way to go, it makes code hard to debug, creates cryptic compiler messages, etc.

    And I was using boost's compile-time regex library for a pull request, but one of the reasons it never got pulled was because it would increase compile times and memory usage when compiling.

  10. laanwj commented at 8:15 AM on May 20, 2012: member

    creates cryptic compiler messages, etc.

    One nitpick: you could use clang. In contrary to gcc, it has wonderfully clear error messages, even with template metaprogramming. Also it compiles much faster.

    But I agree that usage of boost should improve readability, not decrease it.

    And compile-time work is great for time-sensitive inner loops that need to be optimized for specific cases, but using it unnecessarily increases code size and compile time.

  11. suprnurd referenced this in commit 4595db0ce3 on Dec 5, 2017
  12. lateminer referenced this in commit bd090595eb on Jan 22, 2019
  13. lateminer referenced this in commit 5ad9c81acc on May 6, 2020
  14. lateminer referenced this in commit 1517dbe271 on May 6, 2020
  15. lateminer referenced this in commit 521d13b6f0 on May 6, 2020
  16. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-21 18:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me