nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] tweaks: make three conversion specifications more compliant


From: Liu Hao
Subject: Re: [PATCH] tweaks: make three conversion specifications more compliant
Date: Mon, 10 May 2021 23:38:38 +0800
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1

在 2021-05-10 12:46, Hussam al-Homsi 写道:

The actual type of off_t and the conversion specification used to
print it are unknown.
The combination could be int and "%d" on some platforms or long and
"%ld" on others, etc.

This is correct.


It's about matching not fitting.
Now it doesn't change anything on my platform, but that doesn't
conclude that it's standard or portable.

GCC and Clang will silently compile the following original line in the patch:

         sprintf(hexadecimal, "U+%04X", (unsigned char)*this_position);


This needs no change. The `unsigned char` argument corresponds to the ellipse, so it's promoted to `int`, and it is valid to use the `X` specifier which matches the unsigned counterpart of it.



--
Best regards,
Liu Hao

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]