Thread overview
[Issue 11041] New: Some function in core.stdc should be CTFEable
Sep 15, 2013
Tomoya Tanjo
Sep 17, 2013
Don
September 15, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11041

           Summary: Some function in core.stdc should be CTFEable
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: nobody@puremagic.com
        ReportedBy: ttanjo@gmail.com


--- Comment #0 from Tomoya Tanjo <ttanjo@gmail.com> 2013-09-14 22:22:11 PDT ---
It prevents some functions in Phobos from being CTFEable.
For instance, core.stdc.string.memcpy prevents std.algorithm.move from being
CTFEable (I think it should be).

A workaround for it is that we implement functions in druntime in D by
ourselves in each module
but it is better to provide their CTFEable implementations in druntime.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 15, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11041


bearophile_hugs@eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs@eml.cc


--- Comment #1 from bearophile_hugs@eml.cc 2013-09-15 01:41:28 PDT ---
(In reply to comment #0)
> It prevents some functions in Phobos from being CTFEable.
> For instance, core.stdc.string.memcpy prevents std.algorithm.move from being
> CTFEable (I think it should be).
> 
> A workaround for it is that we implement functions in druntime in D by
> ourselves in each module
> but it is better to provide their CTFEable implementations in druntime.

One possible solution is to never use core.stdc.string.memcpy directly in Phobos, and define a D wrapper that contains __ctfe and calls core.stdc.string.memcpy if that's false.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
September 17, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=11041



--- Comment #2 from Don <clugdbug@yahoo.com.au> 2013-09-17 06:59:34 PDT ---
The initial bug report is too vague. We need a list of functions.

Is it just memcpy() and memmove() ? Or are there others?

We also need to consider if the use of those functions in making those algorithms un@safe.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------