[geeks] Quick C question

Dave McGuire mcguire at neurotica.com
Thu Jul 25 04:56:22 CDT 2002


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.

       -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