D on next-gen consoles and for game development

Manu turkeyman at gmail.com
Thu May 23 22:52:11 PDT 2013


On 24 May 2013 15:44, Jonathan M Davis <jmdavisProg at gmx.com> wrote:

> On Friday, May 24, 2013 15:37:39 Manu wrote:
> > I'd say a majority of phobos
> > allocations are created when passing strings through to library/system
> > calls.
>
> That does sound probable, as toStringz will often (and unpredictably)
> result
> in allocations, and it does seem like a prime location for at least
> attempting
> to use a static array instead as you suggested. But if toStringz _wouldn't_
> result in an allocation, then copying to a static array would be
> inadvisable,
> so we're probably going to need a function which does toStringz's test so
> that
> it can be used outside of toStringz.
>

Yeah, an alloca based cstring helper which performs the zero-terminate
check, then if it's not terminated, and short enough, alloca and copy, else
if too long, new.
I'm sure that would be a handy little template, and improve phobos a lot.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20130524/497e47e0/attachment.html>


More information about the Digitalmars-d mailing list