🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3570

Re: printf() format extensions - looking for beta testers...

#3570
From: Peter Seebach
Date: Sun, 21 Apr 1996 17:40
47 lines
3024 bytes
In article <4lbd8k$m2t@solutions.solon.com>,
Sean 'Captain Napalm' Conner <spc@gate.net> wrote:
>  And one I'm wary of.  Again, if I use pre-written code that uses a character
>for a new format that my code wants to use, something isn't going to work
>properly (<sarcasm> and given how well Unix code is well documented
></sarcasm>).

This is a definite potential nuisance, yes.  But it's a "feature" - you
could, for instance, magically cause scanf and printf to start working
with numbers with ,'s or .'s every N digits.

>  As a defence, at least have a compile time option (or run time option) to
>flag options that are redefined, to at least warn the programmer "Thar be
>possible bugs ahead, Arrrrrrrrg!  You have been warned, me mateys!"

Heh.  Not a hopeless idea.

>  And I'm afraid that it'll make my life a living hell (sorry, but I have
>enough problems working with existing poorly written C code (that I have to
>use or get to work) to fully endorse such a construct.	Nothing personal).

This is something I'm wary of too.  But honestly, so much code would me
so much easier to write expressively, that I really want the ability
to do this.

>  Does it HAVE to be printf()?	Can't you create formatp() and use that?  Or
>are you wanting to change some of the default behaviors of printf() so you (or
>someone else) don't(doesn't) have to change much code?

I want to do printf because I disapprove of redundancies; since printf does
what I want to use as a basis, I'd rather extend printf than write another
function which is nearly identical; printf() couldn't be implemented in
terms of a user-definable formatp(), without huge nuisance issues, so it'd
be basically impossible to do "right" without duplicating the majority
of the printf formatting code - which is already sorta big.

I have tons of code I'd eventually rewrite with this, and I may start using
my printf-based implementation even sooner, but no, there's not a huge body
of existing code I care about; this is one of the reasons it's important to
me that existing code survive any changes without effects on its behavior.

-s
-- 
Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
C/Unix wizard -- C/Unix questions? Send mail for help.  No, really!
Unsolicited email is not welcome, and will be billed for at consulting rates.
The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
Technical Details
Message-ID: <4ldrtl$5tq@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4ksk72$rm6@solutions.solon.com> <4l33qn$7rv@solutions.solon.com> <4l3kg4$avi@solutions.solon.com> <4lbd8k$m2t@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: seebs@solon.com (Peter Seebach)
Newsgroups: comp.std.c,comp.lang.c.moderated
Subject: Re: printf() format extensions - looking for beta testers...
Date: 21 Apr 1996 12:40:05 -0500
Organization: Usenet Fact Police (Undercover)
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4ldrtl$5tq@solutions.solon.com>
References: <4ksk72$rm6@solutions.solon.com> <4l33qn$7rv@solutions.solon.com> <4l3kg4$avi@solutions.solon.com> <4lbd8k$m2t@solutions.solon.com>
Reply-To: seebs@solon.com
NNTP-Posting-Host: solutions.solon.com