[geeks] Quick C question

Dave McGuire mcguire at neurotica.com
Thu Jul 25 09:22:19 CDT 2002


On July 25, 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).

  It didn't?  Hmm, that's weird.  It's my understanding that it should
have.

      -Dave

-- 
Dave McGuire                  "Needing a calculator indicates that
St. Petersburg, FL              your .emacs file is incomplete." -Joshua Boyd



More information about the geeks mailing list