Topic
1 reply Latest Post - ‏2010-04-23T15:42:09Z by DaveyC
azue
azue
1 Post
ACCEPTED ANSWER

Pinned topic strlen(NULL)

‏2010-04-20T10:10:12Z |

Hello! Could anybody help me with the following question answer on which I've failed to find:
whether strlen(*NULL*) causes undefined behavior on AIX or developer can rely on some predictible response from runtime library except program's crash, as on some other platforms?
Used AIX versions: 5.1, 5.3, 6.1. XLC compiler versions: 5, 6.
Any reply will be very much appreciated.
Updated on 2010-04-23T15:42:09Z at 2010-04-23T15:42:09Z by DaveyC
  • DaveyC
    DaveyC
    51 Posts
    ACCEPTED ANSWER

    Re: strlen(NULL)

    ‏2010-04-23T15:42:09Z  in response to azue
    IMO, passing a null input pointer to any function is asking for trouble. Even if the runtime is tolerant to invalid arguments it's still a defect in the application. In some languages you would expect a NullPointerException.