🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3831

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

#3831
From: FFarance
Date: Wed, 23 Aug 1995 21:55
33 lines
2054 bytes
> From: geisler@mcs.anl.gov (Jonathan Geisler)
> 
> 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.

How would this lookup work?  Since the format string is interpreted
by "printf", "printf" would have to know how big the next argument
is on the stack -- how would it know how big the next argument is?
If we knew the size of each argument, we wouldn't need the "va_arg"
(variable argument) feature.  Even if we knew how big the stack
argument is, this doesn't tell us anything about the precision used
in that container.  Some implementations might store an "exact:1" as
the high bit, others the low bit -- both have the same container size.
It would be hard to distinquish between "exact:1" and "exact:2" knowing
only the size, yet you'd need to know this information to print the
value properly.

Your solution, although readable, would be very difficult to implement.

-FF
-------------------------------------------------------------------
(``I only use AOL for reading netnews.'')
Frank Farance, Farance Inc.
E-mail: frank@farance.com, Telephone: +1 212 486 4700
ISO JTC1/SC22/WG14 & ANSI X3J11 (C Programming Language) Project Editor
Technical Details
Message-ID: <41g85d$kc@newsbf02.news.aol.com>
Path: arc1-ca.pugleaf.net!newsbf02.news.aol.com!not-for-mail
References: <41fdv8$ici@milo.mcs.anl.gov>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!newsbf02.news.aol.com!not-for-mail
From: ffarance@aol.com (FFarance)
Newsgroups: comp.std.c
Subject: Re: Why "long long" doesn't work.
Date: 23 Aug 1995 17:55:57 -0400
Organization: America Online, Inc. (1-800-827-6364)
Sender: root@newsbf02.news.aol.com
Message-ID: <41g85d$kc@newsbf02.news.aol.com>
References: <41fdv8$ici@milo.mcs.anl.gov>
Reply-To: ffarance@aol.com (FFarance)
NNTP-Posting-Host: newsbf02.mail.aol.com