comparison runtime/internal/lifetime.d @ 910:4c02b41b3dc6

Remove asserts on array consistancy in arraysetlength. Fixes #184, thanks Deewiant.
author Christian Kamm <kamm incasoftware de>
date Thu, 29 Jan 2009 17:45:12 +0100
parents 635f91212b78
children 16264a3973bf
comparison
equal deleted inserted replaced
909:52dad07846be 910:4c02b41b3dc6
605 */ 605 */
606 extern (C) byte* _d_arraysetlengthT(TypeInfo ti, size_t newlength, size_t plength, byte* pdata) 606 extern (C) byte* _d_arraysetlengthT(TypeInfo ti, size_t newlength, size_t plength, byte* pdata)
607 in 607 in
608 { 608 {
609 assert(ti); 609 assert(ti);
610 assert(!plength || pdata); 610 // This assert on array consistency may fail with casts or in unions.
611 // This function still does something sensible even if plength && !pdata.
612 // assert(!plength || pdata);
611 } 613 }
612 body 614 body
613 { 615 {
614 byte* newdata; 616 byte* newdata;
615 size_t sizeelem = ti.next.tsize(); 617 size_t sizeelem = ti.next.tsize();
696 * ... initializer 698 * ... initializer
697 */ 699 */
698 extern (C) byte* _d_arraysetlengthiT(TypeInfo ti, size_t newlength, size_t plength, byte* pdata) 700 extern (C) byte* _d_arraysetlengthiT(TypeInfo ti, size_t newlength, size_t plength, byte* pdata)
699 in 701 in
700 { 702 {
701 assert(!plength || pdata); 703 // This assert on array consistency may fail with casts or in unions.
704 // This function still does something sensible even if plength && !pdata.
705 // assert(!plength || pdata);
702 } 706 }
703 body 707 body
704 { 708 {
705 byte* newdata; 709 byte* newdata;
706 TypeInfo tinext = ti.next; 710 TypeInfo tinext = ti.next;