Suggestion to improve phobos std.string.icmp function

Chad J gamerChad at _spamIsBad_gmail.com
Tue Jul 18 17:02:42 PDT 2006


Jarrett Billingsley wrote:
> "Lionello Lunesu" <lio at lunesu.remove.com> wrote in message 
> news:e9isbu$11ta$1 at digitaldaemon.com...
> 
> 
>>Beware that using a char to index into an array can cause access violation 
>>if the char's negative. You'll get [-1] and such. cast it to a byte.
> 
> 
> In D, character types are always unsigned. 
> 
> 

Yeah I was wondering about that.  I know the characters I was testing on 
would all be negative if they were signed.  I worry though, if this 
can't be relied on then they should all be casted to ubytes, just to 
make sure.  Otherwise, if the spec says somewhere that chars are 
unsigned (I couldn't find it), then it's probably best to leave it.



More information about the Digitalmars-d mailing list