[新闻] dmd2.042发布

yntcsb 2010-03-20
写道
Version D 2.042 Mar 19, 2010
New/Changed Features
Bugs Fixed
Add base class destruction to clear() in object.d
Bugzilla 3842: ICE(expression.c) using pointer in CTFE
Bugzilla 3885: No multithread support for Windows DLL
Bugzilla 3899: CTFE: poor error message for use of uninitialized variable
Bugzilla 3900: CTFE: Wrong return value for array.var assignment
Bugzilla 3901: PATCH: Nested struct assignment for CTFE
Bugzilla 3902: Definition of opCmp
Bugzilla 3912: pure static nested functions are not recognized as pure
Bugzilla 3914: Struct as argument that fits in register has member accessed wrong
Bugzilla 3919: ICE(expression.c, 9944): * or / with typedef ireal
Bugzilla 3920: Assertion failure: '0' on line 10018 in file 'expression.c'
Bugzilla 3930: AAs horribly broken

 http://ftp.digitalmars.com/dmd.2.042.zip

hqs7636 2010-03-20
这个版本太好了,修复了几个大bug,其中有个改动一两千行代码
Colorful 2010-03-21
Add base class destruction to clear() in object.d 是什么意思?
我怎么没找到 clear() 这个类析构函数?
它是可继承的吗?还是 ~this() 的函数版?
hqs7636 2010-03-21
void clear(T)(T obj) if (is(T == class))
2153 {
2154     auto defaultCtor =
2155         cast(void function(Object)) obj.classinfo.defaultConstructor;
2156     version(none) // enforce isn't available in druntime
2157         _enforce(defaultCtor || (obj.classinfo.flags & == 0);
2158     immutable size = obj.classinfo.init.length;
2159
2160     auto ci2 = ci;
2161     do
2162     {
2163         auto dtor = cast(void function(Object))ci2.destructor;
2164         if (dtor)
2165             dtor(obj);
2166         ci2 = ci2.base;
2167     } while (ci2)
2168
2169     auto buf = (cast(void*) obj)[0 .. size];
2170     buf[] = obj.classinfo.init;
2171     if (defaultCtor)
2172         defaultCtor(obj);
2173 }
2174
2175 version(unittest) unittest
2176 {
2177    {
2178        class A { string s = "A"; this() {} }
2179        auto a = new A;
2180        a.s = "asd";
2181        clear(a);
2182        assert(a.s == "A");
2183    }
2184    {
2185        static bool destroyed = false;
2186        class B
2187        {
2188            string s = "B";
2189            this() {}
2190            ~this()
2191            {
2192                destroyed = true;
2193            }
2194        }
2195        auto a = new B;
2196        a.s = "asd";
2197        clear(a);
2198        assert(destroyed);
2199        assert(a.s == "B");
2200    }
2201    {
2202        class C
2203        {
2204            string s;
2205            this()
2206            {
2207                s = "C";
2208            }
2209        }
2210        auto a = new C;
2211        a.s = "asd";
2212        clear(a);
2213        assert(a.s == "C");
2214    }
2215 }
2216

好几个签名
hqs7636 2010-03-21
Colorful 写道
Add base class destruction to clear() in object.d 是什么意思?
我怎么没找到 clear() 这个类析构函数?
它是可继承的吗?还是 ~this() 的函数版?


你那个数据结构如何了,好久没听你介绍了
目前跟dcollections(http://www.dsource.org/projects/dcollections/wiki)比如何,性能,内容(多少),稳定(bug)。。。
hqs7636 2010-03-21
内容上好像差不多,你好像还多点,不知道其他怎么样,有中文文档和中文备注是个好东西。。。只是缺点 sample

2.0的新版本都支持吗?
Global site tag (gtag.js) - Google Analytics