www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/10/31/21:18:07

To: dj AT stealth DOT ctron DOT com (DJ Delorie)
Cc: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: Re: strcat() ?
Date: Tue, 01 Nov 1994 09:20:00 +1100
From: Peter Horan <peter AT deakin DOT edu DOT au>

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


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019