Anyone want to run this through dmc?

Walter Bright newshound2 at digitalmars.com
Fri Jul 22 20:59:22 PDT 2011


On 7/12/2011 10:11 PM, bcs wrote:
> I broke down and installed wine:
>
> bcs at doors:~/Downloads/dmc$ cat split.cpp
> #include<stdio.h>
> struct S0 {
>    unsigned f1 : 1;
> };
>
> struct S0 s;
>
> int main (void) {
>    int x = -3;
>    int y = x>= (0, s.f1);
>    printf ("%d\n", y);
>    return 0;
> }
> bcs at doors:~/Downloads/dmc$ wine dm/bin/dmc.exe split.cpp
> link split,,,user32+kernel32/noi;
>
> bcs at doors:~/Downloads/dmc$ wine split.exe
> 1
>
> seems DMC is broke too, but it's debatable if this test case is of
> value to DMD.

I think DMC is correct here.

    x >= (0, s.f1)

is typed as:

   int >= (int, unsigned)

which is:

   int >= unsigned

which does an unsigned compare,

   0xFFFFFFFD >= 1

which evaluates to:

   1



More information about the Digitalmars-d mailing list