The following posting contains vital information about the
representation of strings (why isn't this in the bloody manual !?!):
http://caml.inria.fr/archives/200208/msg00463.html
String.length is O(1), although the constant term is a tiny bit higher
than it would be if the length was stored explicitly. Most processors
can do arithmetic so fast it hardly matters.
However Xavier's clever representation has one distinct advantage over
a simple length + bytes ("Pascal-like") representation, which is that
the string is _also_ ASCIIZ. Thus the String_val macro in C resolves
to a simple cast (ie. a complete no-op at the assembler level).
Clever huh?
Rich.
--
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
'There is a joke about American engineers and French engineers. The
American team brings a prototype to the French team. The French team's
response is: "Well, it works fine in practice; but how will it hold up
in theory?"'
-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
|
Try Searching:
servers, voip, java, networking, microsoft ...
|
|
|
|