[Issue 2101] New: Please may I use mutable arrays at compile time?
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon May 12 07:25:08 PDT 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2101
Summary: Please may I use mutable arrays at compile time?
Product: D
Version: 2.013
Platform: PC
OS/Version: Windows
Status: NEW
Severity: enhancement
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: caron800 at googlemail.com
The docs say I can't use non-const arrays at compile-time. But I want to, so
this is an enhancement request.
The following does not compile.
int ctfeTest()
{
char[10] a; // <--- PROBLEM
return 1;
}
const int A = ctfeTest();
This does
int ctfeTest()
{
char[] a; // <--- OK
return 1;
}
but that's completely pointless. This doesn't:
int ctfeTest()
{
char[] a = new char[10]; // <--- PROBLEM
return 1;
}
Nor does this:
int ctfeTest()
{
char[] a;
a.length = 10; // <--- PROBLEM
return 1;
}
Even if we can't have dynamic arrays, what's the harm with static ones?
--
More information about the Digitalmars-d-bugs
mailing list