Making regex replace CTFE by removing malloc

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Thu Apr 2 20:58:33 PDT 2015


On Thu, 02 Apr 2015 17:14:24 +0000, Pierre Krafft wrote:

> What can replace malloc that can run on compile time and won't make it
> slower at run time?

this is actually two questions, so i'll answer to two questions.

1. What can replace malloc that can run on compile time?
new ubyte[](size)

2. ...and won't make it slower at run time?
but we can still use malloc in runtime! `if (_ctfe)` allows us to select 
the necessary code branch.

p.s. i don't think that this is the only problem, though. but i never 
read "std.regexp" source. it's bad, 'cause i want to make it work with 
any range, not only with strings. this will allow to run regexp on 
anything -- and open way to my rbtree-based document system.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20150403/4ca1b193/attachment.sig>


More information about the Digitalmars-d mailing list