www.digitalmars.com         C & C++   DMDScript  

c++.dos.16-bits - Bug when Bit-Shifting a long

reply "tjulian" <t t.com> writes:
I have encountered a bug when shifting a 'long' variable. See the sample
program below.

/*
* Test to show bug with bit-shifting a long variable.
* To show bug, compile with
*       sc -msd -3 foo.c
* To remove bug, compile with
*       sc -msd foo.c
*/
#include <stdio.h>

int main(int argc, char *argv[])
{
    unsigned a;
    long b;

    a = 29;
    b = 1L << a;
    printf("b=%08lX",b);
    return(0);
}
Aug 09 2001
parent "Walter" <walter digitalmars.com> writes:
You're right. I'll get it fixed. -Walter

tjulian wrote in message <9kv1ap$1823$1 digitaldaemon.com>...
I have encountered a bug when shifting a 'long' variable. See the sample
program below.

/*
* Test to show bug with bit-shifting a long variable.
* To show bug, compile with
*       sc -msd -3 foo.c
* To remove bug, compile with
*       sc -msd foo.c
*/
#include <stdio.h>

int main(int argc, char *argv[])
{
    unsigned a;
    long b;

    a = 29;
    b = 1L << a;
    printf("b=%08lX",b);
    return(0);
}
Aug 10 2001