[vox-tech] gcc warning question

Samuel Merritt vox-tech@lists.lugod.org
Tue, 15 Oct 2002 12:21:38 -0700


--7JfCtLOvnd9MIVvH
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Tue, Oct 15, 2002 at 11:55:12AM -0700, Peter Jay Salzman wrote:
> gcc warns:
>=20
>    % .!gcc -W -Wall test.c
>    test.c: In function `main':
>    test.c:6: warning: large integer implicitly truncated to unsigned type
>=20
> the variable was declared as an unsigned and the rvalue has the unsigned
> suffix.  what's wrong with this code?   why is gcc complaining?=20

I think you need to use an unsigned long. It looks like sizeof(unsigned
int) =3D 4, and 99999999999 > 2^32.=20
=20
> pete
>=20
>=20
>=20
> #include <stdio.h>
>=20
> int main(void)
> {
> 	unsigned int size =3D 99999999999u;
>=20
> 	printf("size is %u.\n", size);
>=20
> 	return 0;
> }
> _______________________________________________
> vox-tech mailing list
> vox-tech@lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox-tech

--=20
Samuel Merritt
OpenPGP key is at http://meat.andcheese.org/~spam/spam_at_andcheese_dot_org=
.asc
Information about PGP can be found at http://www.mindspring.com/~aegreene/p=
gp/

--7JfCtLOvnd9MIVvH
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)

iD8DBQE9rGrCW3tuPJ1t7wURAhjyAJ9oFdlcqtYYPEbteECUup/95MIilwCfdrM0
lltZMnV9dV6c9zRp50cHWG0=
=WL3y
-----END PGP SIGNATURE-----

--7JfCtLOvnd9MIVvH--