Message-Id: <199808042331.AAA02691@sable.ox.ac.uk> Comments: Authenticated sender is From: George Foot To: Hooman Katirai Date: Wed, 5 Aug 1998 00:30:30 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Re: Possible bit shifting bug ... Reply-to: george DOT foot AT merton DOT oxford DOT ac DOT uk CC: djgpp AT delorie DOT com Precedence: bulk On 4 Aug 98 at 14:53, Hooman Katirai wrote: > The following program gives this output. It is as if no bit shifting is > taking place. I recompiled it as a c program and the same results were > obtained: > > Program: > > #include > main() { > int j=1; > for (int i=0; i<16; i++) { > cout << j; > j << 1; > } > } > > The output is only a series of '1's. No bitshifting ever took place. I think you meant "j <<= 1;". > Guess I'll just have to multiply by two ... until the fix. > Thanks for your time Writing "j * 2;" wouldn't have any effect either ;). You need the assignment: "j *= 2;". -- george DOT foot AT merton DOT oxford DOT ac DOT uk