Article View: comp.std.c
Article #3839Re: Why "long long" doesn't work.
From: Stephen Baynes
Date: Thu, 24 Aug 1995 07:43
Date: Thu, 24 Aug 1995 07:43
43 lines
2328 bytes
2328 bytes
Jonathan Geisler (geisler@mcs.anl.gov) wrote:
: FFarance (ffarance@aol.com) wrote:
: : The "printf" and "scanf" funcitons are extended via the "?" type modifier.
: : For example:
: : printf("%?d",precof(x),x);
: : will always work. Think of "?" as a combination of "*" (takes the next
: : argument) and "l" and "h" (the type modifiers). I you really want to
: : get wild:
: : printf("%*?d",field_width,precof(x),x);
: : The "precof()" operator returns a "prec_t" which extracts the precision
: : information (and other SBEIR information) from the operand. The "scanf"
: : function is extended similarly.
: It seems like a little overkill to have to always include a ?/precof()
: combination for any precision number. Why not define a new modifier
: that will automatically do the same lookup as precof() without the need
: for the programmer to explicitly state it? So, for example, the 2 above
: examples become (assuming the new modifier is 'P'):
: printf("%P", x); AND
: printf("%*P", field_width, x);
: This looks much more reasonable and readable to me.
You would have to change the rules for varargs functions so that the
precision is passed for all parameters.
Simpler and better would be to change the rules for varargs functions so
that instead of the current inegral promotions the promotion is always to
the largest integer type. Then one does not even need any modifer. Also
varargs functions become a lot easier to write as you no longer have to
worry if the argument is smaller or larger than int.
--
Stephen Baynes baynes@mulsoc2.serigate.philips.nl
Philips Semiconductors Ltd
Southampton My views are my own.
United Kingdom
Technical Details
Message-ID:
<DDt1GF.Ls0@ukpsshp1.serigate.philips.nl>Path:
arc1-ca.pugleaf.net!phcoms4.seri.philips.nl!panther!baynesReferences:
<808962429snz@genesis.demon.co.uk> <41crmm$o3u@newsbf02.news.aol.com> <41fdv8$ici@milo.mcs.anl.gov>Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!phcoms4.seri.philips.nl!panther!baynes From: baynes@ukpsshp1.serigate.philips.nl (Stephen Baynes) Subject: Re: Why "long long" doesn't work. Sender: news@ukpsshp1.serigate.philips.nl (account for localnews) Message-ID: <DDt1GF.Ls0@ukpsshp1.serigate.philips.nl> Date: Thu, 24 Aug 1995 07:43:27 GMT References: <808962429snz@genesis.demon.co.uk> <41crmm$o3u@newsbf02.news.aol.com> <41fdv8$ici@milo.mcs.anl.gov> Organization: Philips Semiconductors, Southampton, UK X-Newsreader: TIN [version 1.2 PL2]