Joerg Schilling wrote:
> [EMAIL PROTECTED] wrote:
> > >Comments/suggestions/ideas welcome...
> >
> > Why not a varargs: strMANYcat():
> >
> >       strMANYcat(s, "foo", "/", "bar", NULL);
> >
> > (In most cases, the function call overhead dominates the "finding the
> > end of string" because pushing stack frames modifies memory and
> > finding the end of a string likely to be in the L1 cache is *really*
> > cheap)
> 
> Why not use a name that has been in use since at least 1982.
> 
> strcatl(dest, s1, ..., NULL);
> 
> Implementation (in CDDL) see e.g. star source.

See my comment to Casper Dik - this is IMO bad for at least two reasons:
- You have to handle the varargs overhead. The source code looks smaller
and cleaner but I am not sure whether the resulting binary will be
smaller
- You cannot save pointers to individial elements in the string. For
example if you wish to save the pointer to the beginning of "bar" in the
example above |strcatl()| doesn't help (and you also loose the ability
to measure the string length via the pointer difference via
|retval_of_strFOOcat - s1|).

IMO the second item is the most convincing one for not adopting this
solution. IMO it was a mistake that the original ANSI-C |strcat()|
returns a pointer to the beginning instead of the end and I'd like to
see that fixed...

----

Bye,
Roland

-- 
  __ .  . __
 (o.\ \/ /.o) [EMAIL PROTECTED]
  \__\/\/__/  MPEG specialist, C&&JAVA&&Sun&&Unix programmer
  /O /==\ O\  TEL +49 641 7950090
 (;O/ \/ \O;)
_______________________________________________
opensolaris-discuss mailing list
opensolaris-discuss@opensolaris.org

Reply via email to