Pinned topic strlen(NULL)
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
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 120000JVF462 Posts
Re: strlen(NULL)2010-04-23T15:42:09ZThis is the accepted answer. This is the accepted answer.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.