locked
strlen not supported ?

Answers

  • I can't imagine that strlen would not be available. If you check the list of unsupported CRT functions here you'll notice that it doesn't list strlen as being unsupported. If it works, go ahead and use it. If support is removed later, it'll be a simple fix anyway (which suggests to me that there's no reason to remove it in the first place).

    Software Engineer, Brainium Studios LLC


    • Edited by brentAtBrainium Wednesday, April 25, 2012 8:12 PM
    • Marked as answer by Raptor K Thursday, April 26, 2012 2:43 AM
    Wednesday, April 25, 2012 8:12 PM
  • strlen compiles in a Metro style C++ application, so it is safe to use. The CRT headers have been updated to use the WINAPI_FAMILY etc. macro's so the compiler will tell you if you use an unsafe for Metro style CRT api *** If you use the WINAPI_FAMILY=WINAPI_FAMILY_APP macro in your preprocessor definitions *** at compile time.

    It's come to my attention in discussing this question that the Application Compatibility toolkit does not probe for unsupported _CRT_ calls so it's critical that you use WINAPI_FAMILY=WINAPI_FAMILY_APP in any code that links to the CRT that may further get linked to a Metro style application.

    The current docs are in error and we've got a doc bug pending on that. Thanks for your feedback RaptorCK16

    • Marked as answer by Raptor K Saturday, April 28, 2012 2:22 AM
    Friday, April 27, 2012 6:17 PM
    Moderator

All replies

  • I can't imagine that strlen would not be available. If you check the list of unsupported CRT functions here you'll notice that it doesn't list strlen as being unsupported. If it works, go ahead and use it. If support is removed later, it'll be a simple fix anyway (which suggests to me that there's no reason to remove it in the first place).

    Software Engineer, Brainium Studios LLC


    • Edited by brentAtBrainium Wednesday, April 25, 2012 8:12 PM
    • Marked as answer by Raptor K Thursday, April 26, 2012 2:43 AM
    Wednesday, April 25, 2012 8:12 PM
  • strlen compiles in a Metro style C++ application, so it is safe to use. The CRT headers have been updated to use the WINAPI_FAMILY etc. macro's so the compiler will tell you if you use an unsafe for Metro style CRT api *** If you use the WINAPI_FAMILY=WINAPI_FAMILY_APP macro in your preprocessor definitions *** at compile time.

    It's come to my attention in discussing this question that the Application Compatibility toolkit does not probe for unsupported _CRT_ calls so it's critical that you use WINAPI_FAMILY=WINAPI_FAMILY_APP in any code that links to the CRT that may further get linked to a Metro style application.

    The current docs are in error and we've got a doc bug pending on that. Thanks for your feedback RaptorCK16

    • Marked as answer by Raptor K Saturday, April 28, 2012 2:22 AM
    Friday, April 27, 2012 6:17 PM
    Moderator