Rockbox mail archive
Subject: RE: RB Directory listing order
On Mon, 2 Aug 2004 at 14:28, Stuart Tedford wrote:
> > > There is nothing "natural" about it and I disagree with it at a
> > > fundamental level.
> > Lol. We obviously went to very different schools. I was always taught
> > 12 comes after 2 not between 1 and 2. ;)
> Not if we are dealing with strings, which is what filenames are. This
> "natural sort order" is actually breaking a second standard (ASCII), as
> well as breaking the leading zero standard. Maybe you think 2 wrongs
> make a right, I don't.
Even though a number is part of a filename, it is still a number, here
representing a position in a list.
> I didn't really want to start a flame session or anything (so I shouldn't
> have made the AOL comment, so sorry for any offence I caused), but I feel
> strongly that standards are usually there for a reason - i.e. because a lot
> of people think something is a good idea. So anything that breaks a
> standard should have a very good reason to do so, and I don't consider this
> to be one.
(Feel free to point to a standard that says something about MP3
Seriously, I admit that I myself always number numbered MP3's with a
leading zero, but there are occasions when I receive files that are not
numbered this way, and with the "natural sort" those files are presented
in order, the way I (a human) like them to be presented.
So, for a directory with 1500 files, the time spent sorting is:
strncmp: 84 ticks
strnatcmp: 119 ticks
If it is considered to be of major importance, the strnatcmp code can
surely be optimized to cut down the difference, so no new option would be
Page was last modified "Jan 10 2012" The Rockbox Crew