Uploaded image for project: 'C++ Standard Library'
  1. C++ Standard Library
  2. STDCXX-663

[MSVC] MSVC declares non-standard prototype of the wcstok()

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.2.1
    • Component/s: External
    • Labels:
      None
    • Environment:

      MSVC, ICC/Windows

    • Patch Info:
      Patch Available
    • Severity:
      Incorrect Behavior

      Description

      The MSVC declares non-standard prototype of the wcstok():

      wchar.h:
      -----------
      _CRTIMP wchar_t * __cdecl wcstok(wchar_t *, const wchar_t *);
      -----------

      Since configuration script doesn't check the correct prototype and checks only for name, the config.h file contains _RWSTD_NO_WCSTOK macro undefined.

      The MSVC 8 and higher declares wcstok_s() which is identical to standard wcstok():

      wchar.h:
      -----------
      CRTIMP_ALTERNATIVE __checkReturn wchar_t * __cdecl wcstok_s(_inout_z_opt wchar_t * _Str, __in_z const wchar_t * _Delim, __deref_inout_z_opt wchar_t ** _Context);
      -----------

      I think we need to #define _RWSTD_NO_WCSTOK macro in include/rw/_config_msvcrt.h and add inline wcstok() invoking wcstok_s() in include /ansi/cwchar.

        Attachments

        1. wcstok.patch
          1 kB
          Farid Zaripov

          Activity

            People

            • Assignee:
              farid Farid Zaripov
              Reporter:
              farid Farid Zaripov
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: