• No replies
1 Post

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
    55 Posts

    Re: strlen(NULL)

    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.