Re: Printf question.
- From: Jordan Abel <random832@xxxxxxxxx>
- Date: 31 Dec 2005 17:37:28 GMT
On 2005-12-31, Malcolm <regniztar@xxxxxxxxxxxxxx> wrote:
> "Flash Gordon" <spam@xxxxxxxxxxxxxxxxxx> wrote
>>
>>> Correction: since a signed int can hold any value of type unsigned
>>> char, the value in the unsigned char 'a' is promoted to type int.
>>
>> <annoying pedant>
>> What, even on a system with CHAR_BIT==16 and sizeof(int)==1 ?
>> </annoying pedant>
>>
>> Of course, you are only likely to find such systems in the embedded world
>> where you may well not have printf.
>>
> But often you have vsprintf(), or you need to implement it.
>
> The whole language does begin to break down when we push the limits of
> ANSI's definition. For instance, should field-length parameters really be
> size_t s?
You could take the cheap way out and do stuff along the lines of
sprintf(format,"%%%d.%df",width,precision>=0?precision:0);
c89 doesn't appear to provide for field-length parameters anyway - at
least the draft i have doesn't.
.
- References:
- Printf question.
- From: praeiji
- Re: Printf question.
- From: Jack Klein
- Re: Printf question.
- From: Keith Thompson
- Re: Printf question.
- From: Flash Gordon
- Re: Printf question.
- From: Malcolm
- Printf question.
- Prev by Date: Happy New Year and Merry Christmas!
- Next by Date: Re: How to recognize the Function keys in C
- Previous by thread: Re: Printf question.
- Next by thread: Re: Printf question.
- Index(es):
Relevant Pages
|