Click here to Skip to main content
16,005,491 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Recursively reading from registry Pin
mark%whitedust.net10-Oct-03 4:18
mark%whitedust.net10-Oct-03 4:18 
GeneralRe: Recursively reading from registry Pin
Jonathan [Darka]10-Oct-03 4:20
professionalJonathan [Darka]10-Oct-03 4:20 
GeneralRe: Recursively reading from registry Pin
Michael Dunn10-Oct-03 4:53
sitebuilderMichael Dunn10-Oct-03 4:53 
QuestionHow to call virtual method at CWnd derived class? Pin
vgrigor10-Oct-03 3:49
vgrigor10-Oct-03 3:49 
QuestionHow to use CXIMAGE for printing??? Pin
radha vijay10-Oct-03 2:46
radha vijay10-Oct-03 2:46 
Generalhowto do a splitter in mfc without using views Pin
HeiniBlad10-Oct-03 2:46
HeiniBlad10-Oct-03 2:46 
GeneralRe: howto do a splitter in mfc without using views Pin
jhwurmbach10-Oct-03 2:52
jhwurmbach10-Oct-03 2:52 
Generalfunction template Pin
[CoY0te]10-Oct-03 2:36
[CoY0te]10-Oct-03 2:36 
I'm experimenting with debug tool to report memory leaks. The idea is to create substitute for new and delete operators. I'm using a template function New, and a macro NEW (different for debug and release).
Example below:
<br />
#ifdef _DEBUG<br />
#define NEW(t) (t)*New<t>(__FILE__,__LINE__)<br />
#endif //#ifdef _DEBUG<br />
<br />
template<class T> T* New(char * File,int Line)<br />
{<br />
  T* Pointer=NULL;<br />
  Pointer=(T*)new T;<br />
 ... other code ...<br />
}<br />


This works perfectly for calls like:
<br />
int * a = NEW(int);<br />
int * b = NEW(int[10]);<br />


But the problem is dynamic size of arrays. In this case compiler cannot create template function for types not known at compile-time. So call like this one will not work:
<br />
int a = 10;<br />
int * b = NEW(int[a]);<br />


The error (in VC++ 6.0) is:
error C2540: non-constant expression as array bound

Any ideas of redefining the macro or the function to accept array size as a separate argument?

[ CoY0te ]
Railgun is like a Gilette Mach 3 - it does the job with one, easy stroke.
Generalfunction template (update) Pin
[CoY0te]10-Oct-03 3:15
[CoY0te]10-Oct-03 3:15 
GeneralC/C++ goodies here! Pin
TW10-Oct-03 2:21
TW10-Oct-03 2:21 
GeneralRe: C/C++ goodies here! Pin
Anthony_Yio10-Oct-03 23:16
Anthony_Yio10-Oct-03 23:16 
GeneralUnable to change menus in Visual C++ 6 Pin
Oliver Christian Kjær10-Oct-03 1:50
Oliver Christian Kjær10-Oct-03 1:50 
GeneralRe: Unable to change menus in Visual C++ 6 Pin
Steve S10-Oct-03 1:57
Steve S10-Oct-03 1:57 
GeneralRe: Unable to change menus in Visual C++ 6 Pin
Oliver Christian Kjær10-Oct-03 2:29
Oliver Christian Kjær10-Oct-03 2:29 
GeneralRe: Unable to change menus in Visual C++ 6 Pin
Oliver Christian Kjær10-Oct-03 3:28
Oliver Christian Kjær10-Oct-03 3:28 
GeneralRe: Unable to change menus in Visual C++ 6 Pin
Steve S13-Oct-03 5:31
Steve S13-Oct-03 5:31 
GeneralRe: Unable to change menus in Visual C++ 6 Pin
Oliver Christian Kjær14-Oct-03 21:41
Oliver Christian Kjær14-Oct-03 21:41 
Generalfloat precision Pin
OO-P10-Oct-03 1:11
OO-P10-Oct-03 1:11 
GeneralRe: float precision Pin
Anthony_Yio10-Oct-03 1:33
Anthony_Yio10-Oct-03 1:33 
GeneralRichEdit with Treeview - associating and saving Pin
Kayembi10-Oct-03 0:49
Kayembi10-Oct-03 0:49 
GeneralRe: RichEdit with Treeview - associating and saving Pin
Steve S10-Oct-03 1:42
Steve S10-Oct-03 1:42 
GeneralMFC printing: size and orientation Pin
zsnow9-Oct-03 23:40
zsnow9-Oct-03 23:40 
GeneralRe: MFC printing: size and orientation Pin
Steve S10-Oct-03 1:39
Steve S10-Oct-03 1:39 
GeneralRe: MFC printing: size and orientation Pin
zsnow10-Oct-03 2:14
zsnow10-Oct-03 2:14 
GeneralRe: MFC printing: size and orientation Pin
Steve S10-Oct-03 4:48
Steve S10-Oct-03 4:48 

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.