#define works, const short does not for Ctype array in class
#define works, const short does not for Ctype array in class
- Subject: #define works, const short does not for Ctype array in class
- From: George Woodrow III <email@hidden>
- Date: Mon, 14 Jun 2004 10:23:37 -0400
I have the following code:
const short MaxNEvalValues = 6; // array size for evalValues[]
//#define MaxNEvalValues 6
@interface STQualityStandards : NSObject
{
double tePct; // >= 0.0
double teAbs; // >= 0.0
double sigmaMult; // >= 1.65, default 2.4
short nEvalValues; // 1-6
float evalVals[MaxNEvalValues]; // evalVals[0] must have a value
double maxBiasFac; // default 1, range [0.5, 1.0]
double worstGradeWeight; // [0.0, 1.0], default = 0.3
BOOL useSpecificPatBiasLimitsQ; // normally NO
double patMedLimitPct; // < tePct
double patMedLimitAbs; // < teAbs
}
If I compile this, I get an error:
error: variable-size type declared outside of any function.
If I use the #define, everything works fine, as does hard coding the 6
in the array.
For performance reasons, I need to use a c style array, not an
MSMutableArray.
Using the const works in c/c++.
What do I have to do to make it work in Cocoa?
Thanks
George V. Woodrow III
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.