DMD: Why bytes, etc. are promoted to ints (if not D linkage)
Luhrel
lucien.perregaux at gmail.com
Sat Mar 14 20:32:04 UTC 2020
On Saturday, 14 March 2020 at 15:50:53 UTC, Adam D. Ruppe wrote:
> On Saturday, 14 March 2020 at 15:27:50 UTC, Luhrel wrote:
>> // Promote bytes, words, etc., to ints
>> arg = integralPromotions(arg, sc);
>> ---
>>
>> What was to purpose of this line ?
>
> The C spec requires integers to be promoted to int in such
> cases. C style variadics will be expecting something of `int`
> size or larger.
>
> You can printf("%hd", some_short) but C still expects
> some_short to be promoted to int before passed so it will look
> at 32 bits on the abi level.
>
> [...]
>
Oh ok. Nice to know.
More information about the Digitalmars-d
mailing list