delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2003/09/01/11:32:01

Date: Mon, 1 Sep 2003 11:31:59 -0400
Message-Id: <200309011531.h81FVxlR029934@envy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp-workers AT delorie DOT com
In-reply-to: <F1A9C8D7A58D1B45A9C16FE7E3DA83D702188E@server.HME.hme.ltd.uk>
(Melvin AT HME DOT Ltd DOT uk)
Subject: Re: Non-compliant strxfrm
References: <F1A9C8D7A58D1B45A9C16FE7E3DA83D702188E AT server DOT HME DOT hme DOT ltd DOT uk>
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

>     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.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019