Getting completely (I mean ENTIRELY) rid off GC

Andrei Alexandrescu via Digitalmars-d digitalmars-d at puremagic.com
Sat Sep 13 12:34:48 PDT 2014


On 9/13/14, 9:13 AM, Kagamin wrote:
> On Saturday, 13 September 2014 at 12:05:59 UTC, po wrote:
>>>> Smart pointers are rarely used, most C++ stuff is done by value.
>>>
>>> Strings too?
>>
>>  Two string types are used.
>>
>> -std::string type: by value, has smaller buffer optimization, used at
>> startup/logging, and for any dynamic strings with unbounded possible
>> values
>
> Are you sure? From basic_string.h:
>
>      _CharT*
>      _M_refcopy() throw()
>      {
> #ifndef _GLIBCXX_FULLY_DYNAMIC_STRING
>        if (__builtin_expect(this != &_S_empty_rep(), false))
> #endif
>              __gnu_cxx::__atomic_add_dispatch(&this->_M_refcount, 1);
>        return _M_refdata();
>      }  // XXX MT

C++11 makes all refcounting implementations of std::string illegal. -- 
Andrei


More information about the Digitalmars-d mailing list