It was thus said that the Great Pete Turnbull once stated:
On Apr 24, 1:35, Captain Napalm wrote:
Well, I snagged a copy of it, compiled it,
found a bug, and fixed it.
strcpy() (at least on my compiler) will crash if any of the parameters
are NULL pointers,
That's a compiler (or library, actually) bug. You should be able to copy a
null string.
Well, I've tried it across four platforms and five compilers (Linux/GCC,
Solaris/native and GCC, AIX/native and HPUX/native) and three of the five
core dumped.
I checked the standard and it doesn't say what it should do in case one of
the parameters is NULL, so I assume this is an implementation detail and the
safest thing to do is assume you can't strcpy() a NULL pointer (which I do
anyway).
-spc (Considers that a feature, not a bug)