Subject: Re: Warnings and builds...
To: None <email@example.com>
From: Gordon W. Ross <firstname.lastname@example.org>
Date: 05/06/1997 10:52:51
> Date: Tue, 6 May 1997 10:43:55 -0400 (EDT)
> From: Mike Long <email@example.com>
> Whenever an integer of unknown size is fed to *printf(), you should
> cast it first. In this case, you should use:
> printf("%lu", (unsigned long)sizeof(FOO));
> >So... Is this pointless nit-picking? A good idea?
> I think it's a good idea.
> >Feedback appreciated, especially from people on the platforms (alpha
> >comes to mind) where %d might actually be *wrong* for size_t, if
> >size_t were unsigned long...
> %d is wrong on the i386, which uses `unsigned int' for size_t.
So, presumably one should print "small integer" sizes like this:
printf("... %d\n", (int)sizeof(xxx));