Bug 11041 – Some function in core.stdc should be CTFEable

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-09-14T22:22:00Z
Last change time
2017-07-05T20:23:37Z
Assigned to
nobody
Creator
ttanjo

Comments

Comment #0 by ttanjo — 2013-09-14T22:22:11Z
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.
Comment #1 by bearophile_hugs — 2013-09-15T01:41:28Z
(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.
Comment #2 by clugdbug — 2013-09-17T06:59:34Z
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.
Comment #3 by dlang-bugzilla — 2017-07-05T20:23:37Z
(In reply to Tomoya Tanjo from comment #0) > For instance, core.stdc.string.memcpy prevents std.algorithm.move from being > CTFEable (I think it should be). move is CTFE-able since https://github.com/dlang/phobos/pull/2036. The rest of the issue is too vague to be actionable, please provide specific examples of what you're missing at CTFE.