svn commit: r185594 - head/sbin/newfs_msdos
brde at optusnet.com.au
Thu Dec 4 02:55:40 PST 2008
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
>> 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
> 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.
More information about the svn-src-head