Path: utzoo!attcan!uunet!husc6!cmcl2!nrl-cmf!ames!pasteur!ucbvax!ucsd!ucsdhub!cuuxun!cuuxb!mmengel
From: mmengel@cuuxb.ATT.COM (~XT4103000~Marc Mengel~C25~G25~6184~)
Newsgroups: comp.sys.att
Subject: Re: Am I seeing things?
Keywords: compiler problems
Message-ID: <1873@cuuxb.ATT.COM>
Date: 27 Jun 88 13:54:43 GMT
References: <547@tsc.dec.com>
Reply-To: mmengel@cuuxb.UUCP (PUT YOUR NAME HERE)
Organization: AT&T, Data Systems Group, Lisle, IL
Lines: 37

In article <547@tsc.dec.com> pete@tsc.dec.com (Pete Schmitt) writes:
>When I run the following code on a VAX running Ultrix 2.2 I get a
>correct output of:
[example output deleted]
>Where is the problem?  Is this a bug?

/* lpowd.c */
main()
{
	long b,e,a,lpow();
	b = 2;
	e = 4;
	a = lpow(b,e);
	printf("%d to the %dth = %d\n",b,e,a);
*****************^SPLAT  should be %ld for a long int, you are printing
			 the low and high word of the 2, then the low
			 word of the 4...
}
	
long lpow(lnum, n)
	
	long lnum;
	long n;
	{
		long p;
		p=1;
		for ( ; n > 0; --n)
			p *= lnum;
		return (p);
	}


-- 
 Marc Mengel			       
				
 attmail!mmengel	
 {lll-crg|mtune|ihnp4}!cuuxb!mmengel