[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-hackers] [PATCH] Send C_DEBUGGER_REPLY_GET_BYTES responses
From: |
John Cowan |
Subject: |
Re: [Chicken-hackers] [PATCH] Send C_DEBUGGER_REPLY_GET_BYTES responses as unsigned char values |
Date: |
Sat, 5 Mar 2016 11:45:55 -0500 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Peter Bex scripsit:
> Does this mean an unsigned char argument to a varags function is always
> widened to "int"? How else can it know how much to take off the stack?
Yes, it does. This pattern is called "the integer promotions" in the C
standards: _Bool, short, char, bitfield, and enum types are automatically
promoted to int, or if int is too small, to unsigned int, whenever (a)
they are used in an expression, or (b) passed as a function argument
and there is no function prototype in scope (which there cannot be for
varargs arguments). Basically, C does not deal with types narrower than
int unless a function prototype forces it to.
> And if it really is the case that characters are always widened to
> integers, why bother to have a %c format specifier in the first place?
The %c format specifier converts its input to a character and outputs that
character. There is no other format specifier that does this.
--
John Cowan http://www.ccil.org/~cowan address@hidden
Where the wombat has walked, it will inevitably walk again.
(even through brick walls!)