Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Sorting of strings is broken
Re: Sorting of strings is broken [message #52011 is a reply to message #52010] Thu, 04 July 2019 16:24 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Thank you, fixed. The bug was lost when posted in [code] - it was utf-8 related. (That said, I am of course quite frightened and ashamed that something like this was in Core for quite some time...)

The problem was that this failed:

	String a = "1911s";
	String b = "1911-12 in Scottish football";
	ASSERT(a < b);


'-' there is not basic ascii, but some higher utf-8 encoded unicode. So it is 3 byte sequence starting with 0xe3, hence it should be sorted after a. However, in one critical place characters were compared signed, which lead in < transitivity failure, which lead to sorting 1911s after 1911s/doc (you can check svn revision for details).

I am sorry about any inconviences this has caused.

(Note: the '-' in code section here is 'normal', I had to fix it because othrewise it gets ignored by the forum).

Mirek

[Updated on: Thu, 04 July 2019 16:25]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Problem with FixedVectorMap/FixedArrayMap
Next Topic: MemorySanitizer: use-of-uninitialized-value in CoWork
Goto Forum:
  


Current Time: Fri Apr 26 23:02:20 CEST 2024

Total time taken to generate the page: 0.05680 seconds