Re: Two Questions about "strlen", "strcat" and "strcpy"
From: Karthiik Kumar (kaykaydreamz_nospam_at_yahoo.com)
Date: 08/30/04
- Next message: Paul Hsieh: "Re: Two Questions about "strlen", "strcat" and "strcpy""
- Previous message: Dan Pop: "Re: Two Questions about "strlen", "strcat" and "strcpy""
- In reply to: Matt: "Two Questions about "strlen", "strcat" and "strcpy""
- Next in thread: Paul Hsieh: "Re: Two Questions about "strlen", "strcat" and "strcpy""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Aug 2004 05:03:08 GMT
Matt wrote:
> I have 2 questions:
>
> 1. strlen returns an unsigned (size_t) quantity. Why is an unsigned
> value more approprate than a signed value? Why is unsighned value less
> appropriate?
>
>
>
I cannot think of a string that has its length to be -ve. How would
a string of length -1 look like (as if that makes sense !! ) ?
> 2. Would there be any advantage in having strcat and strcpy return a
> pointer to the "end" of the destination string rather than returning a
> pointer to its beginning?
With the whole lot of string manipulation functions expecting a
pointer to the beginning of the string , to have strcpy / strcat return
pointer to the beginning of the string would be orthogonal to the API,
instead of other ways like pointing to its 'end' etc.
-- Karthik -- comp.lang.c.moderated - moderation address: clcm@plethora.net
- Next message: Paul Hsieh: "Re: Two Questions about "strlen", "strcat" and "strcpy""
- Previous message: Dan Pop: "Re: Two Questions about "strlen", "strcat" and "strcpy""
- In reply to: Matt: "Two Questions about "strlen", "strcat" and "strcpy""
- Next in thread: Paul Hsieh: "Re: Two Questions about "strlen", "strcat" and "strcpy""
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|