Subject: RE: Non-compliant strxfrm MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Date: Wed, 3 Sep 2003 09:15:37 +0100 content-class: urn:content-classes:message X-MimeOLE: Produced By Microsoft Exchange V6.0.4417.0 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Non-compliant strxfrm Thread-Index: AcNxdwxzfU/rWx4TTSu60qLSP2txhQAeuKeg From: "Melvin Curran" To: "DJ Delorie" Cc: Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id h838Ffr17761 Reply-To: djgpp-workers AT delorie DOT com > -----Original Message----- > From: DJ Delorie [mailto:dj AT delorie DOT com] > > Thanks, but I think this needs some further work, since > this fragment: > > > > if (--n) > > *dst++ = c; > > > > seems to dereference dst even if n is zero. The standard forbids > > that, see our prior discussions in this thread. > > No, it can't. That case is already detected in the preceeding if: > > if (n < 2) > { > while (*src++ != 0) > r++; > break; > } > if (--n) > *dst++ = c; > Looking at this bit of code again, because of that first if statement the second will always evaluate true, so we could get rid of the second if by changing it to: --n; *dst++ = c;