View mode: basic / threaded / horizontal-split · Log in · Help
July 08, 2004
DMD 0.95 release
Finally, the new printf is here! (called writef). The rest are bug fixes.

http://www.digitalmars.com/d/changelog.html
July 08, 2004
Re: DMD 0.95 release
Walter wrote:

> Finally, the new printf is here! (called writef). The rest are bug fixes.
> 
> http://www.digitalmars.com/d/changelog.html

And more important, writefln which will save a lot \n's to the world <g>
July 08, 2004
Re: DMD 0.95 release
Walter wrote:

> Finally, the new printf is here! (called writef). The rest are bug fixes.
> 
> http://www.digitalmars.com/d/changelog.html

cool. writef is nice and simple and as flexible as printf. Is someone going
to add a std.stream wrapper for writef? (Sean? me?) A corresponding readf
would be nice since then we could replace std.stream.scanf. It could also
be worth deprecating std.stream.printf, too, though it just ends up calling
C's printf so it isn't a big deal.

-Ben
July 08, 2004
Re: DMD 0.95 release
"Walter" <newshound@digitalmars.com> wrote in message
news:cck67e$2irt$1@digitaldaemon.com...
> Finally, the new printf is here! (called writef). The rest are bug fixes.

Although i can't get writef to work (only writefln) it is a great
improvement
over printf. BUT: Why do fwritef and fwritefln take FILE* as an argument
and not a Stream or something like that?

>
> http://www.digitalmars.com/d/changelog.html
>
>
July 09, 2004
Re: DMD 0.95 release
"Ivan Senji" <ivan.senji@public.srce.hr> wrote in message
news:cckkic$6gf$1@digitaldaemon.com...
> "Walter" <newshound@digitalmars.com> wrote in message
> news:cck67e$2irt$1@digitaldaemon.com...
> > Finally, the new printf is here! (called writef). The rest are bug
fixes.
>
> Although i can't get writef to work (only writefln) it is a great
> improvement
> over printf.

This works:
-----------------------------------------
C:\mars>type test.d

import std.stdio;

void main()
{
   std.stdio.writef("hello\n");
}

C:\mars>dmd test
\dm\bin\link test,,,user32+kernel32/noi;

C:\mars>test
hello

C:\mars>
----------------------------------------------


> BUT: Why do fwritef and fwritefln take FILE* as an argument
> and not a Stream or something like that?

std.format.doFormat() is designed to work with anything you want.
July 09, 2004
Re: DMD 0.95 release
> "Walter" <newshound@digitalmars.com> wrote in message
> news:cck67e$2irt$1@digitaldaemon.com...
> Finally, the new printf is here! (called writef). The rest are bug
fixes.

Wow, writef() is cool! This'll make displaying information alot easier than it
was before with printf()!

writef("NUMBER: ", 3);

instead of:

printf("NUMBER: %i", 3);

Thanks, Walter (and whoever else contributed to the writef() function)!
July 09, 2004
Re: DMD 0.95 release
Walter wrote:

> Finally, the new printf is here! (called writef). The rest are bug fixes.
> 
> http://www.digitalmars.com/d/changelog.html

Presumably we're going to have versions of writef for strings and Stream 
objects?  OK, so it would be straightforward to write them ourselves, 
but they'd be such common, simple operations there would otherwise be 
several independently-written copies around (a bit like the many copies 
of bubble sort that C programmers who haven't discovered how to qsort 
keep around...).

The obvious way would be to add writef and writefln methods to Stream 
(we'd have Unicode or not to consider - maybe also writefW and 
writeflnW), and to create a function

	dchar[] swritef(...);

(by analogy with sprintf - but still don't know if that's the best name) 
to return a formatted string.  I'll probably code up these additions 
over the weekend if nobody else is going to....

BTW there are a few kinds of types you haven't told us the default 
formatting for:

- characters (presumably the character itself)
- structs and unions (presumably .toString(), if it has one....)
- enums (do these count as integral types?)
- arrays other than strings
- pointers
- function pointers/delegates
- have I missed any?

Stewart.

-- 
My e-mail is valid but not my primary mailbox, aside from its being the 
unfortunate victim of intensive mail-bombing at the moment.  Please keep 
replies on the 'group where everyone may benefit.
July 09, 2004
gaps in writef formats
"Stewart Gordon" <smjg_1998@yahoo.com> wrote in message
news:cclsjm$20s5$1@digitaldaemon.com...
> BTW there are a few kinds of types you haven't told us the default
> formatting for:
>
> - characters (presumably the character itself)

The character itself.

> - structs and unions (presumably .toString(), if it has one....)

Yup. Though this won't work yet for structs until TypeInfo is improved.

> - enums (do these count as integral types?)

Enums I have special plans for. When TypeInfo gets better, I plan to have
writef write out the enum identifier corresponding to the value. Right now,
they come out as integers.

> - arrays other than strings

Waiting on improved TypeInfo. Probably will do a comma separated list.

> - pointers
> - function pointers/delegates

Like %p.
July 10, 2004
Re: DMD 0.95 release
In article <cck67e$2irt$1@digitaldaemon.com>, Walter says...
>
>Finally, the new printf is here! (called writef). The rest are bug fixes.
>
>http://www.digitalmars.com/d/changelog.html
>
>

Walter: Bravo! I really likee the new 'C' printf() replacements in 'D',
especially the writef() and writefln() functions, which I've been converting all
the printf()s to writefln()s in my current 'D' code! :)) They work Great!!

Also v0.95 fixed the problems I had found in v0.93 and v0.94...Thxs!

<*-Hint-*>I know that I promised not to bug you, but it has been a little while
now, so here goes nothing...are you any closer to putting in the ifind(), and
irfind() (and maybe hopefully the ireplace() and icount() functions) into
std.string? Please. I need them for the code I'm writing, and it would be a lot
better if they're already in the Phobos runtime library. Plus I'm very close to
announcing the opening of an expanded 'D' programming section to my home page
soon, so it would be nice have the functions in place.

-------------------------------------------------------------------
"Dare to reach for the Stars...Dare to Dream, Build, and Achieve!"
July 10, 2004
Re: DMD 0.95 release
"David L. Davis" <SpottedTiger@yahoo.com> wrote in message
news:ccnnvn$1ko1$1@digitaldaemon.com...
> In article <cck67e$2irt$1@digitaldaemon.com>, Walter says...
> >
> >Finally, the new printf is here! (called writef). The rest are bug fixes.
> >
> >http://www.digitalmars.com/d/changelog.html
> >
> >
>
> Walter: Bravo! I really likee the new 'C' printf() replacements in 'D',
> especially the writef() and writefln() functions, which I've been
converting all
> the printf()s to writefln()s in my current 'D' code! :)) They work Great!!
>
> Also v0.95 fixed the problems I had found in v0.93 and v0.94...Thxs!
>
> <*-Hint-*>I know that I promised not to bug you, but it has been a little
while
> now, so here goes nothing...are you any closer to putting in the ifind(),
and
> irfind() (and maybe hopefully the ireplace() and icount() functions) into
> std.string? Please. I need them for the code I'm writing, and it would be
a lot
> better if they're already in the Phobos runtime library. Plus I'm very
close to
> announcing the opening of an expanded 'D' programming section to my home
page
> soon, so it would be nice have the functions in place.

Don't worry, I'll get to them.
« First   ‹ Prev
1 2 3
Top | Discussion index | About this forum | D home