Richard Heathfield <> writes:
> santosh said:
>> jacob navia wrote:
>
> <snip>
>
>>> This means that interfaces like strncpy of gets or asctime are OK?
>>
>> Of course not.
>
> The asctime function seems rather pointless to me, and gets is of course
> unusable. But what is your objection to strncpy?
There is occasionally a good reason to use strncpy(). However:
* Using strncpy() into a large buffer can be very inefficient.
strncpy() always writes to every byte in the destination
buffer, which can waste a lot of time if the destination
buffer is much longer than the source string.
* If the source string is longer than the size of the
destination buffer, then strncpy() doesn't write a
terminating null. So a call to strncpy() must be followed
by explicitly writing a null terminator at the end of the
destination buffer in most cases.
--
char a[]="\n .CJacehknorstu";int putchar(int);int main(void){unsigned long b[]
={0x67dffdff,0x9aa9aa6a,0xa77ffda9,0x7da6aa6a,0xa6 7f6aaa,0xaa9aa9f6,0x11f6},*p
=b,i=24;for(;p+=!*p;*p/=4)switch(0[p]&3)case 0:{return 0;for(p--;i--;i--)case+
2:{i++;if(i)break;else default:continue;if(0)case 1

utchar(a[i&15]);break;}}}