Re: strcpy and strcat's return type



Lew Pitcher:
zeroDontSpamtype@xxxxxxxxx:
....
Why do strcpy and strcat (and strupr and strlwr in some nonstandard
implementations) return a char*? Surely the logical (and DMA-safe)
)return type for these would have been void??

Why should strcat() return a void *, when both of it's arguments are char *, and the function is defined as working on character strings?

He said void, not void *. And to answer the actual question: I think, they return char * to allow such things as

  return strcat(strcpy(buf, path), file);

Jirka
.



Relevant Pages

  • strcpy and strcats return type
    ... Why do strcpy and strcat (and strupr and strlwr in some nonstandard ... implementations) return a char*? ... Surely the logical (and DMA-safe) ...
    (comp.lang.c)
  • strcpy and strcat return type
    ... implementations) return a char*? ... Surely the logical (and DMA-safe) ... have an appropriate newsgroups line in your header for your mail to be seen, ...
    (comp.lang.c.moderated)
  • Re: strcpy and strcats return type
    ... > implementations) return a char*? ... Surely the logical (and DMA-safe) ... Originally there was no such keyword as "void" so a function ... They would be better off being void functions now, ...
    (comp.lang.c)
  • Re: Size of a pointer
    ... Pointer to char and pointer to void have the ... object may contain more information than pointer to void or char. ... It just so happens that I have worked with many implementations over ...
    (comp.lang.c.moderated)
  • [PATCH 2.6.19-rc1 V9] drivers: add LCD support
    ... Adds support for the ks0108 LCD Controller as a device driver. ... +The buffer should be a 128*64 unsigned char array: ... * GNU General Public License for more details. ... +static void cfag12864b_setbit ...
    (Linux-Kernel)