[sldev] Uses of LLString and std::string ?

Dave Parks davep at lindenlab.com
Wed Jan 23 08:34:02 PST 2008


I believe the point of LLString is to protect against NULL pointer 
assignments.  It's legacy from a time when we used char* strings and 
began mixing in std::string.  Assigning a standard string to NULL 
dereferences NULL, causing a crash.  LLString protects against this by 
checking for NULL on assignment for char* strings.

Alissa Sabre wrote:
> I have a question.
>
> SL viewer uses two data types LLString and std::string, that are
> almost identical.  They are sometimes intermixed.  LLString to
> std::string conversion is by a simple upcasting, but the opposit is by
> a deep copy through a constructor that requires some overhead.
>
> What is the purpose of LLString?  In case it has some, then the next
> question is why LL uses both LLString and std::string?  (Cf. LL never
> uses C++ bool type.)
>
> Assuming there is a good reason to use both LLString and std::string
> in SL viewer, what is the criteria (or guidelines) to choose from
> LLString and std::string?
>
>     Alissa Sabre
> --------------------------------------
> Easy + Joy + Powerful = Yahoo! Bookmarks x Toolbar
> http://pr.mail.yahoo.co.jp/toolbar/
> _______________________________________________
> Click here to unsubscribe or manage your list subscription:
> /index.html
>   



More information about the SLDev mailing list