LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-11-2006, 06:30 AM   #16
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148

Quote:
Originally Posted by George2
Why comparison of the characters with the same length is faster than variable-length characters? I think it depends on how we implement the comparison algorithm.
If you are doing a comparison with variable-length characters then you will need to do two checks, per character in the string. First what is the character length, then how do they compare with each other. Whereas if you are using fixed-length characters you need to do just a single check, per character in the string, namely the comparison.

The actual comparison rules are locale defined, and may mix the single byte and double byte characters. for example the character a can also come with accents - grace, acute umlaut. Different languages will have different comparison rules, for some it will bundle 'a' along with all its accented variants other locales will have all the un-accented characters followed by accented characters. So to do the comparison requires to lookup the locale defined order on a table and then convert this to a number which makes the comparison easier but to get the table in the first place requires the underlying data structure to be - well, structured - of a fixed width.

I realise that in trying to condense the description I may have made it more confusing so feel free to ask further questions.

graeme.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming in C Tutorial Mercurius Programming 22 05-08-2006 05:01 PM
Looking for C/C++ unicode related programming tutorial George2 Programming 1 05-01-2006 07:56 AM
glib programming tutorial (c) con Programming 3 12-16-2005 12:21 AM
looking for X programming tutorial (C or C++) qwijibow Programming 1 02-02-2004 08:33 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:19 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration