Eliminate C-style array declarations.

This commit is contained in:
H. S. Teoh 2014-08-30 06:51:27 -07:00
parent 76e2edb463
commit 76db0de19c
6 changed files with 11 additions and 11 deletions

View file

@ -9649,7 +9649,7 @@ unittest
writeln("unittest @", __FILE__, ":", __LINE__, " done."); writeln("unittest @", __FILE__, ":", __LINE__, " done.");
// sort using delegate // sort using delegate
int a[] = new int[100]; int[] a = new int[100];
auto rnd = Random(unpredictableSeed); auto rnd = Random(unpredictableSeed);
foreach (ref e; a) { foreach (ref e; a) {
e = uniform(-100, 100, rnd); e = uniform(-100, 100, rnd);
@ -9934,7 +9934,7 @@ unittest
writeln("unittest @", __FILE__, ":", __LINE__, " done."); writeln("unittest @", __FILE__, ":", __LINE__, " done.");
auto rnd = Random(1); auto rnd = Random(1);
int a[] = new int[uniform(100, 200, rnd)]; int[] a = new int[uniform(100, 200, rnd)];
foreach (ref e; a) { foreach (ref e; a) {
e = uniform(-100, 100, rnd); e = uniform(-100, 100, rnd);
} }
@ -10787,7 +10787,7 @@ unittest
auto lowEnt = ([ 1.0, 0, 0 ]).dup, auto lowEnt = ([ 1.0, 0, 0 ]).dup,
midEnt = ([ 0.1, 0.1, 0.8 ]).dup, midEnt = ([ 0.1, 0.1, 0.8 ]).dup,
highEnt = ([ 0.31, 0.29, 0.4 ]).dup; highEnt = ([ 0.31, 0.29, 0.4 ]).dup;
double arr[][] = new double[][3]; double[][] arr = new double[][3];
arr[0] = midEnt; arr[0] = midEnt;
arr[1] = lowEnt; arr[1] = lowEnt;
arr[2] = highEnt; arr[2] = highEnt;
@ -10819,7 +10819,7 @@ unittest
auto lowEnt = ([ 1.0, 0, 0 ]).dup, auto lowEnt = ([ 1.0, 0, 0 ]).dup,
midEnt = ([ 0.1, 0.1, 0.8 ]).dup, midEnt = ([ 0.1, 0.1, 0.8 ]).dup,
highEnt = ([ 0.31, 0.29, 0.4 ]).dup; highEnt = ([ 0.31, 0.29, 0.4 ]).dup;
double arr[][] = new double[][3]; double[][] arr = new double[][3];
arr[0] = midEnt; arr[0] = midEnt;
arr[1] = lowEnt; arr[1] = lowEnt;
arr[2] = highEnt; arr[2] = highEnt;

View file

@ -2864,11 +2864,11 @@ unittest
{ {
static if(real.mant_dig == 64) static if(real.mant_dig == 64)
{ {
ushort value[5]; ushort[5] value;
} }
else static if(real.mant_dig == 53) else static if(real.mant_dig == 53)
{ {
ushort value[4]; ushort[4] value;
} }
else else
static assert(false, "Not implemented"); static assert(false, "Not implemented");

View file

@ -2555,7 +2555,7 @@ unittest
string unit_file = deleteme ~ "-unittest_write.tmp"; string unit_file = deleteme ~ "-unittest_write.tmp";
if (exists(unit_file)) remove(unit_file); if (exists(unit_file)) remove(unit_file);
write(unit_file, buf); write(unit_file, buf);
void buf2[] = read(unit_file); void[] buf2 = read(unit_file);
assert(buf == buf2); assert(buf == buf2);
string unit2_file = deleteme ~ "-unittest_write2.tmp"; string unit2_file = deleteme ~ "-unittest_write2.tmp";

View file

@ -3336,7 +3336,7 @@ template BacktrackingMatcher(bool CTregex)
} }
//lookup next match, fill matches with indices into input //lookup next match, fill matches with indices into input
bool match(Group!DataIndex matches[]) bool match(Group!DataIndex[] matches)
{ {
debug(std_regex_matcher) debug(std_regex_matcher)
{ {
@ -6688,7 +6688,7 @@ unittest
string flags; string flags;
} }
enum TestVectors tv[] = [ enum TestVectors[] tv = [
TestVectors( "a\\b", "a", "y", "$&", "a" ), TestVectors( "a\\b", "a", "y", "$&", "a" ),
TestVectors( "(a)b\\1", "abaab","y", "$&", "aba" ), TestVectors( "(a)b\\1", "abaab","y", "$&", "aba" ),
TestVectors( "()b\\1", "aaab", "y", "$&", "b" ), TestVectors( "()b\\1", "aaab", "y", "$&", "b" ),

View file

@ -197,7 +197,7 @@ private:
ubyte[size] store; ubyte[size] store;
// conservatively mark the region as pointers // conservatively mark the region as pointers
static if (size >= (void*).sizeof) static if (size >= (void*).sizeof)
void* p[size / (void*).sizeof]; void*[size / (void*).sizeof] p;
} }
// internals // internals

View file

@ -72,7 +72,7 @@ int main(char[][] args)
auto r = regex(""); // regex auto r = regex(""); // regex
uint ranseed = std.random.unpredictableSeed; uint ranseed = std.random.unpredictableSeed;
thisTid; thisTid;
int a[]; int[] a;
a.reverse; // adi a.reverse; // adi
a.sort; // qsort a.sort; // qsort
Clock.currTime(); // datetime Clock.currTime(); // datetime