Date: Mon, 1 Sep 2003 11:31:59 -0400 Message-Id: <200309011531.h81FVxlR029934@envy.delorie.com> From: DJ Delorie To: djgpp-workers AT delorie DOT com In-reply-to: (Melvin AT HME DOT Ltd DOT uk) Subject: Re: Non-compliant strxfrm References: Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk > strxfrm(NULL, "hello", 0) = 0 > strxfrm(answer, "hello", 9) = 5 > strxfrm(answer, "hello", 3) = 5 > > 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 Linux does not agree: strxfrm ((null), hello, 0) = 5 strxfrm (buf, hello, 9) = 5 strxfrm (buf, hello, 3) = 5 "returns the length of the transformed string" means the transformation of the source, not the stored results. I.e., the length *before* truncating to fit the buffer. Remember, "n" is the size of the output buffer, not the size of the input string.