March 24, 2005 Re: GC/associative arrays/or both BUG | ||||
---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | "Sean Kelly" <sean@f4.ca> wrote in message news:d1t39s$mpd$1@digitaldaemon.com... > From what you said the problem is that the struct S isn't aligned in a way that's compatible with the current GC implementation. Since the sample code was > pretty straightforward (ie. it contained no alignment instructions or odd pointer gymnastics) this sounds like a bug to me, but I wasn't clear from your > response whether you considered it to be. Yes, it's a bug in the compiler. > Basically, I was wondering whether > Ben's sample will work correctly in a future D release or if the code will have > to be modified. I don't see any reason why it wouldn't work. > Also, I was curious whether adding an alignment qualifier to > the struct declaration would be sufficient to fix the problem, thus the > "align(4) struct S" question. No, that wouldn't fix it. |
March 25, 2005 Re: GC/associative arrays/or both BUG | ||||
---|---|---|---|---|
| ||||
Posted in reply to Ben Hinkle Attachments: | Ben Hinkle wrote: | "bobef" <bobef@paintballforce.com> wrote in message | news:d1s370$2lqf$1@digitaldaemon.com... | |>I don't know... It is strange to me... I am not competent enough to |>deal with garbage collectors... |>I just hope Walter will fix it, because it makes my program not |>working... | | | Here are shorter reproduction steps: | import std.stdio; | import std.gc; | struct S | { | byte number; | char[] description; | char[] font_face; | byte font_size; | ushort flags; | int colour_back; | int colour_fore; | byte charset; | } | int main(char[][] argv) | { | S[] x; | writefln("size %d",S.sizeof); | | for (int i=0;i<3;i++) { | S s; | s.font_face="font face".dup; | x ~= s; | } | | /* works fine | S s; | s.font_face="font face".dup; | x ~= s; | s.font_face="font face".dup; | x ~= s; | s.font_face="font face".dup; | x ~= s; | s.font_face="font face".dup; | x ~= s; | */ | fullCollect(); | writefln("%s",x[0].font_face); | writefln("%s",x[1].font_face); | return 0; | } Added to DStress as http://dstress.kuehne.cn/run/align_08.d http://dstress.kuehne.cn/run/align_09.d http://dstress.kuehne.cn/run/align_10.d Thomas |
Copyright © 1999-2021 by the D Language Foundation