This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: wcscpy broken
- From: Ulrich Weigand <weigand at immd1 dot informatik dot uni-erlangen dot de>
- To: drepper at redhat dot com (Ulrich Drepper)
- Cc: weigand at immd1 dot informatik dot uni-erlangen dot de (Ulrich Weigand), schwab at suse dot de, nevyn-glibc-alpha at and dot org, uweigand at de dot ibm dot com, libc-alpha at sources dot redhat dot com
- Date: Mon, 3 Feb 2003 01:32:53 +0100 (MET)
- Subject: Re: wcscpy broken
Ulrich Drepper wrote:
> Broken compilers don't count as when looking at "validly generated"
> codo. The single increment form had performance advantages and any kind
> of argumentation which has only the benefit to help platforms with
> broken tools, ABIs, concepts will fall on deaf ears. Require people to
> use a sane compiler.
I have no problem with requiring people to use a fixed compiler in the
particular case I originally described. I just think that there are
other cases where non-aligned wide strings could validly occur, as I
mentioned.
Of course, it is possible to keep a single increment form of wcscpy
that still allows arbitrary alignment; something like
wchar_t *wcp = (wchar_t *) src;
wint_t c;
const ptrdiff_t off = (char *)dest - (char *)(src + 1);
do
{
c = *wcp++;
*(wchar_t *)((char *)wcp + off) = c;
}
while (c != L'\0');
should do just fine (and generate even marginally better code than
the original form).
Bye,
Ulrich
--
Dr. Ulrich Weigand
weigand@informatik.uni-erlangen.de