Mail Archives: djgpp/1994/10/31/21:18:07
> > The C library string functions have an unstated precondition that string
> > pointers are not NULL. It is up to the user to ensure this. strcat() will not
> > test your arguments.
>
> My ansi reference (not quite the official one, but a summary reference) states:
>
> "If an argument to a library function has a pointer type, then the
> value of the argument expression must be a valid address for a data
> object of its type. This is true even if the library function has no
> need to access a data object by using the pointer argument."
>
> The example they give includes this line:
>
> strcpy(s1, NULL) is INVALID
Thank you. I have never seen this statement and still have not found it. In my
opinion, it is important enough that is should be stated on the actual man
pages involved where it will be drawn to the attention of the user at the
right time, rather than having to learn from experience.
Peter Horan School of Computing and Mathematics
peter AT deakin DOT edu DOT au Deakin University
Geelong
+61-52-27 1234 (Voice) Victoria 3217
+61-52-27 2028 (FAX) Australia
- Raw text -