Skip site navigation (1)Skip section navigation (2)
Date:      08 Jul 2001 23:54:40 +0200
From:      Dag-Erling Smorgrav <des@ofug.org>
To:        arch@freebsd.org
Subject:   Type differences
Message-ID:  <xzpbsmvqe73.fsf@flood.ping.uio.no>

next in thread | raw e-mail | index | archive | help
des@des /usr/src/sys% grep 'define.*BSD_SIZE_T' {i386,alpha}/include/ansi.h
i386/include/ansi.h:#define     _BSD_SIZE_T_    unsigned int            /* sizeof() */
alpha/include/ansi.h:#define    _BSD_SIZE_T_    unsigned long           /* sizeof() */
des@des /usr/src/sys% grep 'define.*BSD_OFF_T' {i386,alpha}/include/ansi.h
i386/include/ansi.h:#define     _BSD_OFF_T_     __int64_t               /* file offset */
alpha/include/ansi.h:#define    _BSD_OFF_T_     long                    /* file offset */

What's the idea here?  off_t is the exact same size and signedness on
both platforms, so why not use the same definition for both?  And why
make size_t an int on i386 but a long on alpha, when on both these
platforms int and long are identical?

Also, gcc (correctly) complains about a "comparison between signed and
unsigned" when you try to compare a size_t to an off_t on alpha - but
doesn't complain on i386.  What gives?

And while we're on this subject, what's the Officially Approved way of
printf()ing an off_t or a size_t so it does not generate warnings on
either platform?

DES
-- 
Dag-Erling Smorgrav - des@ofug.org

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzpbsmvqe73.fsf>