[Issue 22994] importC: some types not zero-initialized in static array

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Apr 11 16:42:40 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=22994

--- Comment #1 from duser at neet.fi ---
test with more cases:

char cs1[1];
double ds1[1];
char cs[2] = {0};
double ds[2] = {0.0};
struct { char cs[2]; } css = { {0} };
struct { double ds[2]; } dss = { {0} };
union { char cs[2]; } csu = { {0} };
union { double ds[2]; } dsu = { {0} };
int printf(char *, ...);
int main()
{
        printf("%d\n", (int)cs1[0]);
        printf("%lf\n", ds1[0]);
        printf("%d\n", (int)cs[1]);
        printf("%lf\n", ds[1]);
        printf("%d\n", (int)css.cs[1]);
        printf("%lf\n", dss.ds[1]);
        printf("%d\n", (int)csu.cs[1]);
        printf("%lf\n", dsu.ds[1]);
        printf("%d\n", (int)((char[2]){0})[1]);
        printf("%lf\n", ((double[2]){0})[1]);
        return 0;
}

enums aren't affected anymore, they seem to have been fixed for good

--


More information about the Digitalmars-d-bugs mailing list