Tamarin:String implementation: Difference between revisions

m
→‎Design: fix typos
m (→‎Design: fix typos)
 
Line 12: Line 12:


# Direct strings, where the character data immediately follows the instance data. Memory is allocated via low-level calls to GC-Alloc() with an in-place constructor call.
# Direct strings, where the character data immediately follows the instance data. Memory is allocated via low-level calls to GC-Alloc() with an in-place constructor call.
# Static strings, where the character data is kept elsewhere. This data must be guaranteed to exist longer than the String instance itself. C character constans are good candidates. ABC data is also be a good candidate as long as the unload of the ABC data does not cause the data these strings to become invalid.
# Static strings, where the character data is kept elsewhere. This data must be guaranteed to exist longer than the String instance itself. C character constants are good candidates. ABC data is also be a good candidate as long as the unload of the ABC data does not cause the data in these strings to become invalid.
# Dependent strings, where a DRC'ed pointer keeps a reference to the master string, and the string contains a pointer to the start of the character data, and a length count.
# Dependent strings, where a DRC'ed pointer keeps a reference to the master string, and the string contains a pointer to the start of the character data, and a length count.


Out-of-memory conditions will be handled by the allocator in a future version. The String class uses checks for NULL, and returns NULL for new strings whose allocation failed.  
Out-of-memory conditions will be handled by the allocator in a future version. The String class uses checks for NULL, and returns NULL for new strings whose allocation failed.


=== UTF-8, UTF-16 and UTF-32 ===
=== UTF-8, UTF-16 and UTF-32 ===
10

edits