T.R | Title | User | Personal Name | Date | Lines |
---|
2127.1 | confirmed :-) | TAVENG::BORIS | Boris Gubenko, ISE | Tue Mar 25 1997 13:12 | 18 |
|
I don't want to look protecting DEC C RTL Reference Manual at any price -
the Manual leaves a lot to be desired - but it seems to me, that in this
(relatively rare :-) case the Manual provides a clear answer:
int i = 1;
printf("%3.3d\n",i);
According to the precision field, "the minimum number of DIGITS to appear"
is 3, so we have 001 (it is obviously, that zero is the only digit which
can be used to satisfy the precision).
Now, because we already have an output field of width 3, no padding for the
width is performed.
How would you suggest to make the Manual more clear?
Boris
|
2127.2 | Thanks, and... | CSC32::J_HENSON | Don't get even, get ahead! | Wed Mar 26 1997 09:33 | 29 |
| >> <<< Note 2127.1 by TAVENG::BORIS "Boris Gubenko, ISE" >>>
>> -< confirmed :-) >-
>> int i = 1;
>> printf("%3.3d\n",i);
>> According to the precision field, "the minimum number of DIGITS to appear"
>> is 3, so we have 001 (it is obviously, that zero is the only digit which
>> can be used to satisfy the precision).
>> Now, because we already have an output field of width 3, no padding for the
>> width is performed.
>> How would you suggest to make the Manual more clear?
Boris,
Thanks for the confirmation. I'll pass it on to my customer.
As for making the manual more clear, I can offer this.
In this particular case, there appear to be two different and conflicting
descriptions. One which addresses padding, and the other which addresses
the precision, and which happens to be the overriding rule. Perhaps
some verbage which defines which rule takes precedence over the other
in cases such as this would be appropriate.
Jerry
|
2127.3 | thanks for the suggestion | TAVENG::BORIS | Boris Gubenko, ISE | Wed Mar 26 1997 12:16 | 32 |
| Jerry,
Thanks for the suggestion.
Description of the field width uses the term "converted output source" which
implies, that the field width is considered after the conversion is done:
field width The minimum field width can be designated...
...
If the converted output source is wider than...
...
If the converted output source is narrower than...
Probably, we should emphasis the fact, that the field width is the last
component of the format directive processed by printf() (see also note 2068
in this conference).
How about:
field width The minimum field width can be designated ....
The minimum field width is considered after the
conversion is done according to the all other
components of the format directive. This component
affects padding the result of the conversion as
follows:
If the result of the conversion is wider than...
...
If the result of the conversion is narrower than...
Boris
|
2127.4 | looks better to me | CSC32::J_HENSON | Don't get even, get ahead! | Mon Mar 31 1997 10:21 | 14 |
| >> <<< Note 2127.3 by TAVENG::BORIS "Boris Gubenko, ISE" >>>
>> -< thanks for the suggestion >-
Boris,
That looks better. Personally, though, I think that wording this so that
someone doesn't misinterpret it is very hard to do. There are just too
many factors to mention....
I'm just glad that it's someone else's job to wordsmith this. ;-)
Thanks,
Jerry
|