On Thu, 23 Nov 2006 02:40:30 -0000
"peternilsson42" <[EMAIL PROTECTED]> wrote:

> Strictly speaking, '\0' and 0 do have the same value and
> type in C. [They have different types in C++.] That's not
> to say you should start using '\0' as a null pointer
> constant.

yes indeed. 0x00000 is a valid memory address. AFAIK.

> Well strncpy is not necessarily a good example since it need
> not terminate the resultant character sequence with a null
> byte...
> 
>   char dst[3];
>   strncpy(dst, "Hello", sizeof dst);
> 
>   /* dst[0] = 'H';
>      dst[1] = 'e';
>      dst[2] = 'l'; */

yes, which is why one should ensure the returned string is terminated.
but this serves as a good example for the overflow problem. :o) 

anyone know why snprintf is not in MFC?

-- 
Regards, Ed                      :: http://s5h.net/u?l
proud python hacker
"Get hit by a firetruck" can always be found on Vin Diesel's to-do 
list. 

Reply via email to