🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #3565

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

#3565
From: Stan Ryckman
Date: Mon, 15 Apr 1996 04:49
47 lines
1874 bytes
In article <4kr74a$k8o@solutions.solon.com>,
Sean 'Captain Napalm' Conner <spc@gate.net> wrote:

[snip most]

:  Well, why not change the approach?  The current printf() will accept a
:line such as:
:
:		printf("%*s",someint,somestring);
:
:  To allow variable widths to be specified.  Why not extend that and pass in
:the function pointers?  Something like:
:
:		printf("%p@",myfunctptr,myptrtype);
:
:  Where '@' specifies a format function, and the letter before it declares
:the type using a single letter specification:
:
:		c	- char
:		s	- short
:		i	- int
:		l	- long
:		f	- float
:		d	- double
:
:  With the following modifiers:
:
:		p	- pointer (if alone, void *)
:		u	- unsigned
:	
:  Less chance of clashes, and more flexible I feel.

Uh, no.  "%p@" already has a meaning (for example) -- print a pointer
representation, and then an '@' character.  Same for "%c@" etc.

You might retry this with "%@p@", "%@c@", ... . But I'd suggest
changing your modifiers to be consistent with "normal" ones; e.g.
"h" for short, "f" for double (note that float cannot be passed
here), etc.

(Since "@" is not in the C character set, and doesn't even have
a trigraph assigned to it, there are other problems with this...)

Cheers,
Stan.
--
Stan Ryckman  (stanr@tiac.net)
Technical Details
Message-ID: <4kskgt$roo@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4kll9l$o5h@solutions.solon.com> <4kobun$8i2@solutions.solon.com> <4koecq$8up@solutions.solon.com> <4kr74a$k8o@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: stanr@tiac.net (Stan Ryckman)
Newsgroups: comp.std.c,comp.lang.c.moderated
Subject: Re: printf() format extensions - looking for beta testers...
Date: 14 Apr 1996 23:49:33 -0500
Organization: Amber & Sneakers Fan Club
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4kskgt$roo@solutions.solon.com>
References: <4kll9l$o5h@solutions.solon.com> <4kobun$8i2@solutions.solon.com> <4koecq$8up@solutions.solon.com> <4kr74a$k8o@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com