Mentor for C self study wanted

cpghost cpghost at cordula.ws
Tue Oct 23 15:52:26 PDT 2007


On Tue, 23 Oct 2007 23:36:40 +0100
Bruce Cran <bruce at cran.org.uk> wrote:

> cpghost wrote:
> 
> > There's a mismatch here: scanf("%d", ...) expects a pointer to int,
> > while &nnote is a pointer to a short. Normally, an int occupies more
> > bytes in memory than a short (typically sizeof(int) == 4 on 32bit
> > platforms, and sizeof(int) == 8 on 64bit platforms; while typically
> > sizeof(short) == 2).
> 
> I think short and int stay the same on both 32 and 64 bit platforms, 
> while it's only long that gets bumped to 8 bytes.  At least that
> seems to be what happens on FreeBSD amd64.

Hmmm... yep, you're right, I'm wrong! I've switched compilers
too often recently. Yes, on gcc sizeof(int) == 4 on both 32bit and
64bit. Thanks for pointing this out: I stay corrected. ;)

-- 
Cordula's Web. http://www.cordula.ws/


More information about the freebsd-questions mailing list