[geeks] Quick C question

Joshua D Boyd jdboyd at cs.millersville.edu
Thu Jul 25 08:02:10 CDT 2002


On Thu, Jul 25, 2002 at 05:56:22AM -0400, Dave McGuire wrote:
> On July 24, Joshua D Boyd wrote:
> > In the belief that good code should compile without even warnings, I
> > can't figure out how to make G++ stop warning about this line:
> > 
> > s = s * 2891336453 + 1;
> > 
> > The warning is: 
> > 
> > decimal integer constant is so large that it is unsigned
> 
>   Explicitly cast the integer to an unsigned int:
> 
>   s = s * (unsigned int)2891336453 + 1;
> 
>   This should make the compiler warning go away.

That's what I thought, but it didn't.  Although, I actually used
(unsigned long) rather than (unsigned int) (since s in an unsigned long).

-- 
Joshua D. Boyd



More information about the geeks mailing list