DervishD <[EMAIL PROTECTED]> writes:

> Yes, you're true, but... How about using C99 large integer types
> (intmax_t and family)?

But then I can use `long long' just as well, which is supported by C99
and (I think) required to be at least 64 bits wide.  Portability is
the whole problem, so suggestions that throw portability out the
window aren't telling me anything new.

Using #ifdefs to switch between %d/%lld/%j *is* completely portable,
but it requires three translations for each message.  The translators
would feast on my flesh, howling at the moonlight.

Hmm.  How about preprocessing the formats before passing them to
printf?  For example, always use "%j" in strings, like this:

    printf (FORMAT (_("whatever %j\n")), num);

On systems that support %j, FORMAT would be defined to no-op.
Otherwise, it would be defined to a format_transform function that
converts %j to either %lld or %.0f, depending on whether the system
has long long or not (in which case it would use double for large
quantities).

> That's the better I can get, because when I wrote portable code, by
> portable I understand 'according to standards'. For me that means,
> in that order: SuSv3, POSIX, C99, C89, stop. No pre-ANSI and no
> brain damaged compilers.

I understand your position -- it's perfectly valid, especially when
you have the privilege of working on a system that supports all those
standards well.  But many people don't, and Wget (along with most GNU
software of the era) was written to work for them as well.  I don't
want to support only POSIX systems for the same reason I don't want to
support only the GNU system or only the Microsoft systems.  For me,
portability is not about adhering to standards, it's about making
programs work in a wide range of environments, some of which differ
from yours.

Thanks for your suggestions.

Reply via email to