Click here to Skip to main content
15,925,181 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questionwhat is LValue error?. Pin
NewtonOfComputers18-Sep-04 20:46
NewtonOfComputers18-Sep-04 20:46 
AnswerRe: what is LValue error?. Pin
Andras Zoltan19-Sep-04 3:11
Andras Zoltan19-Sep-04 3:11 
QuestionCan I group function (method) within Struct in ANSI C? Pin
Link260018-Sep-04 19:05
Link260018-Sep-04 19:05 
AnswerRe: Can I group function (method) within Struct in ANSI C? Pin
Michael Dunn18-Sep-04 19:16
sitebuilderMichael Dunn18-Sep-04 19:16 
GeneralRe: Can I group function (method) within Struct in ANSI C? Pin
Link260018-Sep-04 19:23
Link260018-Sep-04 19:23 
AnswerRe: Can I group function (method) within Struct in ANSI C? Pin
cmk18-Sep-04 21:00
cmk18-Sep-04 21:00 
GeneralRe: Can I group function (method) within Struct in ANSI C? Pin
Anonymous18-Sep-04 18:10
Anonymous18-Sep-04 18:10 
Generalstatic constant template member problems Pin
Andras Zoltan18-Sep-04 12:17
Andras Zoltan18-Sep-04 12:17 
I have a template class inside which I wish to embed some static constants to speed up some time-critical code. Consider this:

template <class T, int I> class X<br />
{<br />
private:<br />
  static const icopy = i;<br />
  static const iminus1 = i-1;<br />
  static const itimes8 = i<<3;<br />
  int array[I];<br />
public:<br />
  (..)<br />
};


I is assigned by the code using the template to the size of T, which is fine when the compiler uses it to create the array with num elements equal to I.

However, all of the static constants appear to be getting initialised to 1, even when I is explicitly set to 4 or 8.

I wish to make these constants static in order to reduce memory overhead, therefore a solution to this problem is kinda essential to me? Am I mis-using the language? Or is it an example of VS.Net 2003's C++ compiler's non-conformance?

Confused | :confused:

Please help!

Thanks in advance...
GeneralRe: static constant template member problems Pin
Michael Dunn18-Sep-04 12:56
sitebuilderMichael Dunn18-Sep-04 12:56 
GeneralRe: static constant template member problems Pin
Andras Zoltan19-Sep-04 3:08
Andras Zoltan19-Sep-04 3:08 
GeneralRe: static constant template member problems Pin
Michael Dunn19-Sep-04 11:50
sitebuilderMichael Dunn19-Sep-04 11:50 
GeneralRe: static constant template member problems Pin
Andras Zoltan20-Sep-04 12:25
Andras Zoltan20-Sep-04 12:25 
GeneralRe: static constant template member problems Pin
Michael Dunn20-Sep-04 12:36
sitebuilderMichael Dunn20-Sep-04 12:36 
Questionhow to remove MDI doc template Pin
Igemon18-Sep-04 11:22
Igemon18-Sep-04 11:22 
GeneralDLL debug error message.. Pin
Laing,James18-Sep-04 10:38
Laing,James18-Sep-04 10:38 
GeneralRe: DLL debug error message.. Pin
Tim Smith18-Sep-04 19:17
Tim Smith18-Sep-04 19:17 
GeneralRe: DLL debug error message.. Pin
cmk18-Sep-04 21:17
cmk18-Sep-04 21:17 
QuestionDialog to Tray? Pin
Larsson18-Sep-04 9:44
Larsson18-Sep-04 9:44 
Generaldisplaying the cursor Pin
Member 117092518-Sep-04 9:29
Member 117092518-Sep-04 9:29 
GeneralAdvice needed for a DB project. Pin
crimsongrape18-Sep-04 8:48
crimsongrape18-Sep-04 8:48 
GeneralRe: Advice needed for a DB project. Pin
cmk18-Sep-04 21:25
cmk18-Sep-04 21:25 
GeneralON_CHANGE of CRicheditCtrl works abnormality in windows 98 Pin
Anonymous18-Sep-04 5:57
Anonymous18-Sep-04 5:57 
GeneralTake answer from a user then go to certain string Pin
intilli18-Sep-04 4:43
intilli18-Sep-04 4:43 
QuestionDialog q? Pin
Larsson18-Sep-04 3:29
Larsson18-Sep-04 3:29 
AnswerRe: Dialog q? Pin
Ravi Bhavnani18-Sep-04 7:19
professionalRavi Bhavnani18-Sep-04 7:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.