Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!wuarchive!uunet!taumet!steve From: steve@taumet.com (Stephen Clamage) Newsgroups: comp.lang.c Subject: Re: what is this supposed to do? Keywords: left shift Message-ID: <689@taumet.com> Date: 24 Apr 91 15:08:45 GMT References: <1991Apr22.225641.1122@midway.uchicago.edu> Organization: Taumetric Corporation, San Diego Lines: 16 langer@gibbs.uchicago.edu (Steve Langer) writes: >What is the expected output from the following program? Is it defined? >#include >main() { > printf("1 << 32 = %o\n", ((unsigned) 1) << 32); >} It is not defined, so the variation in outputs you got is legal. In 3.3.7, the Standard says "If the value of the right operand [of the shift operator] ... is greater than or equal to the width in bits of the promoted left operand, the behavior is undefined." -- Steve Clamage, TauMetric Corp, steve@taumet.com