🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3827

Re: Why "long long" doesn't work.

#3827
From: Jonathan Geisler
Date: Wed, 23 Aug 1995 14:28
29 lines
1518 bytes
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.

						-- Jonathan Geisler --
Technical Details
Message-ID: <41fdv8$ici@milo.mcs.anl.gov>
Path: arc1-ca.pugleaf.net!milo.mcs.anl.gov!geisler
References: <808962429snz@genesis.demon.co.uk> <41crmm$o3u@newsbf02.news.aol.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!milo.mcs.anl.gov!geisler
From: geisler@mcs.anl.gov (Jonathan Geisler)
Newsgroups: comp.std.c
Subject: Re: Why "long long" doesn't work.
Date: 23 Aug 1995 14:28:56 GMT
Organization: Argonne National Laboratory, Chicago, Illinois
Message-ID: <41fdv8$ici@milo.mcs.anl.gov>
References: <808962429snz@genesis.demon.co.uk> <41crmm$o3u@newsbf02.news.aol.com>
NNTP-Posting-Host: dalek.mcs.anl.gov
X-Newsreader: TIN [version 1.2 PL0]