Compile time static array issues.

Era Scarecrow rtcvb32 at yahoo.com
Sat May 28 15:57:52 PDT 2011


 I don't seem to have a good explanation why this isn't working. All i end up
getting is 'Error: cannot implicitly convert expression .... of type
string[][] to joined[]'. I also get 'incompatible types for (("AADT") ? (16)):
'string' and 'int''. I've tried it with casts, and full array qualifiers.

 I'm using DMD 2.053.

--

 struct joined {
	string name;
	string partof;
	string preReq;
}

struct subrecord_parts {
	string name;
	int size;
	string[] notes;
	int identifyBy;
	int[] partSize;
}

joined[] attached;
subrecord_parts[] parts;

static this() {
	attached = [
		["MAST", "DATA", "TES3"],
		["ANAM","INTV", "FACT"]];

	parts = [
		["AADT", 16, ["fWeight", "iValue", "iUses", "fQuality"], -1, [4,4,4,4]],
		["AODT", 24, ["iType", "fWeight", "iValue", "iHealth", "iEnchant Points",
"iArmour"],  -1, [4,4,4,4,4,4]]];
}

-- output
test.d(20): Error: cannot implicitly convert expression
([["MAST","DATA","TES3"],["ANAM","INTV","FACT"]]) of type string[][] to joined[]
Error: incompatible types for (("AADT") ? (16)): 'string' and 'int'
Error: incompatible types for (("AODT") ? (24)): 'string' and 'int'
test.d(26): Error: cannot implicitly convert expression
([[(__error),(__error),(__error),(__error),(__error)],[(__error),(__error),(__error),(__error),(__error)]])
of type _error_[][] to subrecord_parts[]


More information about the Digitalmars-d-learn mailing list