Newsgroups: comp.std.c
Path: utzoo!sq!msb
From: msb@sq.sq.com (Mark Brader)
Subject: Warnings (was: Semi constant expressions)
Message-ID: <1989Sep5.181331.14764@sq.sq.com>
Reply-To: msb@sq.com (Mark Brader)
Organization: SoftQuad Inc., Toronto
References: <1237@gmdzi.UUCP> <1989Aug31.175652.29643@sq.sq.com> <1989Sep1.111928.27836@jarvis.csri.toronto.edu>
Date: Tue, 5 Sep 89 18:13:31 GMT

> > >	x << (100000000L)	/* Non-conforming, see 3.3.7 */
> > By the way, the L on the right operand has no effect.  ...
> > and the plain constant 100000000 would be [int] or [long] depending on the
> > size of ints.
> But a good compiler might warn you if you say "100000000" and it gets promoted
> to long.

Well, an even better compiler might do this only in a context where it
matters whether int or long is used.  In an example such as the above or
such as "long johns = 100000000;", the type of the constant is irrelevant.

-- 
Mark Brader			"'You wanted it to WORK?  That costs EXTRA!'
SoftQuad Inc., Toronto		 is probably the second-place security hole
utzoo!sq!msb, msb@sq.com	 after simple carelessness."	-- John Woods

This article is in the public domain.
