[MLton] %zu printf formatter does not port
ville at laurikari.net
Wed Aug 15 03:23:29 PDT 2007
On HP-UX, printf does not implement the "z" length specifier (for
printing size_t values). GCC is not aware that %z does not work, and
gives no warning.
I suppose it's OK to change the occurrences of %zu to a macro. This
would be defined by the appropriate platform/<os>.h to something which
works on the current platform.
How does PRIusz (accompanied with FMTusz) sound? It appears that for
size_t there are no predefined macros in the spirit of PRIu32 and
friends. We would then also need a typedef to cast printf arguments
to match the printf formatter. This could be called "priusz".
Alternatively, we could cast size_t to uintmax_t and use PRIuMAX for
printing. The advantage with this would be that the printf macros are
already defined so there would be less changes overall.
More information about the MLton