Subject: RE: Non-compliant strxfrm MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Date: Mon, 1 Sep 2003 16:08:45 +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: AcNwjFx6rBzzbRU3T7OwnmxF1UP9+AACoO3Q From: "Melvin Curran" To: Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id h81F8sq23555 Reply-To: djgpp-workers AT delorie DOT com Well, here is the output from the standard strxfrm for various inputs: strxfrm(NULL, "hello", 0) = 0 strxfrm(answer, "hello", 9) = 5 strxfrm(answer, "hello", 3) = 5 and here is what the standard says about the return value: 3 The strxfrm function returns the length of the transformed string (not including the terminating null character). If the value returned is n or more, the contents of the array pointed to by s1 are indeterminate. 4 EXAMPLE The value of the following expression is the size of the array needed to hold the transformation of the string pointed to by s. 1 + strxfrm(NULL, s, 0) As you can see, the first call doesn't conform to the example given (this is the main problem), and the third call gives an answer which indicates that the tranformed string is indeterminate, and that isn't the case here. Admittedly, the third answer might be ok given the relationship between strcoll and strxfrm/strcmp as described in the standard, but I decided to do it the way I did instead. For comparison, here is what my function gives for answers: strxfrm(NULL, "hello", 0) = 5 strxfrm(answer, "hello", 9) = 5 strxfrm(answer, "hello", 3) = 2 -----Original Message----- From: DJ Delorie [mailto:dj AT delorie DOT com] Sent: Monday, 01 September 2003 13:54 To: djgpp-workers AT delorie DOT com Subject: Re: Non-compliant strxfrm > I found that the DJGPP version was almost completely wrong. In what way?