Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Has thought been given given to a cleaned up C? Possibly called C+.

1 view
Skip to first unread message

io_x

unread,
Mar 11, 2010, 11:13:28 AM3/11/10
to
"io_x" <a...@b.c.invalid> ha scritto nel messaggio
news:4b98b93b$0$825$4faf...@reader5.news.tin.it...
>> why not somethig of this kind
>> f64 v;
>> cout << fmt("%4:4f64") << v;

[post to c and c++ newsgroup]

the above should be possible in C++ (pheraps using instead "%4.4f").

don't remember what is fmt, could be one "stream manipulator"? could be
one class [the call to one constructor of a tmp object]?
don't know. do you know it someone of you?

Is it possible this below?
double a, b;
cout << SPrintf("%2.2f %2.3f", a, b) << "\n";

with SPrintf() one function (stream manipulator?)
ostream& SPrintf(ostream& v, char* fmt, ...)?
that print like printf() in stdout?

Paavo Helde

unread,
Mar 11, 2010, 2:49:39 PM3/11/10
to
"io_x" <a...@b.c.invalid> wrote in news:4b9914a2$0$1113
$4faf...@reader4.news.tin.it:

Ellipsis cannot be made to work type-safely in C++. Instead, one uses some
kind of operator overloading, which takes care of needed conversions. There
is the boost.format library, the usage looks like:

cout << format("%2.2f %2.3f") % a % b;

hth
Paavo

Phil Carmody

unread,
Mar 11, 2010, 7:27:27 PM3/11/10
to

puke

--
I find the easiest thing to do is to k/f myself and just troll away
-- David Melville on r.a.s.f1

io_x

unread,
Mar 12, 2010, 3:13:36 AM3/12/10
to

"io_x" <a...@b.c.invalid> ha scritto nel messaggio
news:4b9914a2$0$1113$4faf...@reader4.news.tin.it...

but not used much that "cout << fmt("%4.4f") << v",
now the c++ functions that i write deal with files has prototipe like

int ImDoAll(typstruct* res, type* a, FILE* f1, FILE* f2, FILE* f3);


0 new messages