Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 4 Dec 2008 21:55:28 +1100 (EST)
From:      Bruce Evans <brde@optusnet.com.au>
To:        Max Laier <max@love2party.net>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, Max Laier <mlaier@freebsd.org>, src-committers@freebsd.org
Subject:   Re: svn commit: r185594 - head/sbin/newfs_msdos
Message-ID:  <20081204213600.G4414@delplex.bde.org>
In-Reply-To: <200812040009.30837.max@love2party.net>
References:  <200812032300.mB3N0vZW003970@svn.freebsd.org> <200812040009.30837.max@love2party.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 4 Dec 2008, Max Laier wrote:

> On Thursday 04 December 2008 00:00:57 Max Laier wrote:
>> Author: mlaier
>> Date: Wed Dec  3 23:00:57 2008
>> New Revision: 185594
>> URL: http://svn.freebsd.org/changeset/base/185594
>>
>> Log:
>>   Fix build - cast off_t to (intmax_t) for printing.

intmax_t is declared in <stdint.h>, but this patch gets it by including
the full bloat of <inttypes.h>.  However, <inttypes.h> is needed for
a complete fix.  Input of off_t's is still broken -- it uses strtoll(),
but should use strtoimax() so as not to depend on the implementation
of off_t and so as not to have style bugs (any use of long long).

> I'd really like to typedef the int64 types "long long" on all architectures
> :-\  It's a big POLA violation in my opinion and causes quite a bit of porting
> headache.  Or at least let's fix printf to understand that "long" types on
> 64bit architectures can be printed with %ll.  Since they are - in fact - 64bit
> wide.
>
> But I keep reiterating this point - I guess I still don't understand the exact
> reason why we can't just do that.

This would break detection of the bug that you fixed.  Printing off_t using
either %ld or %lld is a bug, since off_t might not be either of long or
long long.  Having %ld (physically) incompatible with long long on 32-bit
arches and %lld (only logically) incompatible with long long on 64-bit
arches results in both errors being detected eventually.

Bruce



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