• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
#define works, const short does not for Ctype array in class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

#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.


  • Follow-Ups:
    • Re: #define works, const short does not for Ctype array in class
      • From: Alexander Spohr <email@hidden>
    • Re: #define works, const short does not for Ctype array in class
      • From: Robert Kuilman <email@hidden>
  • Prev by Date: Re: even after the longish diatribes on copying....
  • Next by Date: Re: InputManagers
  • Previous by thread: Re: even after the longish diatribes on copying....
  • Next by thread: Re: #define works, const short does not for Ctype array in class
  • Index(es):
    • Date
    • Thread