Making regex replace CTFE by removing malloc

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Sun Apr 5 09:48:42 PDT 2015


On Fri, 03 Apr 2015 15:04:38 +0000, Pierre Krafft wrote:

> It seems like I have treaded into something which is outside my
> knowledge domain. The malloc is indeed one of the least problems with
> that code. The code makes use of completely unsafe code with pointer
> casts that are disallowed in CTFE code. If someone knows how to replace
> the pointer casts that would probably be everything needed. Otherwise I
> think it would need a rewrite to make it use safe D. The new code would
> probably be slower so for most people it would be a step back. A
> solution would be to have different code for CTFE and runtime but that
> seems unmaintainable and subpar.

i believe that pointer casts are there for speed reasons. or maybe the 
engine just didn't designed for CTFE in the first place.

anyway, you can ask your questions here or in "D.learn". even if you will 
not be able to convert the current engine to CTFE, you may be able to use 
a subset of it as a base for separate CTFE regexp engine. i believe that 
it is possible to write a moderately good Thompson-based code, which 
covers alot of needs.
-------------- 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/20150405/bffa0553/attachment-0001.sig>


More information about the Digitalmars-d mailing list