Click here to Skip to main content
16,008,183 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Generala dialog applicaion assosciated with system tray Pin
rohit.dhamija30-Jan-03 23:41
rohit.dhamija30-Jan-03 23:41 
GeneralRe: a dialog applicaion assosciated with system tray Pin
Rage31-Jan-03 0:05
professionalRage31-Jan-03 0:05 
GeneralRe: a dialog applicaion assosciated with system tray Pin
Abbas_Riazi31-Jan-03 0:08
professionalAbbas_Riazi31-Jan-03 0:08 
GeneralRe: a dialog applicaion assosciated with system tray Pin
rohit.dhamija31-Jan-03 0:20
rohit.dhamija31-Jan-03 0:20 
GeneralRe: a dialog applicaion assosciated with system tray Pin
Abbas_Riazi31-Jan-03 0:34
professionalAbbas_Riazi31-Jan-03 0:34 
GeneralInternational settings Pin
Rage30-Jan-03 23:19
professionalRage30-Jan-03 23:19 
GeneralRe: International settings Pin
Mike Eriksson3-Feb-03 4:24
Mike Eriksson3-Feb-03 4:24 
GeneralQuestion about new operator. Pin
George230-Jan-03 23:16
George230-Jan-03 23:16 
Hi, everyone!

I do not understand what is the function of new operator
in the following example. Especially this statement,

--------
(void)new (pint) Elem(10);
--------

Another question, when compiling, a warning jumps out like the
following, I want to know how to avoid the warning.

Thanks in advance,
George

--------
c:\program files\microsoft visual studio\myprojects\testnew\testnew.cpp(25) : warning C4291: 'void *__cdecl operator new(unsigned int,void *)' : no matching operator delete found; memory will not be freed if initialization throws an exception
--------


#include <iostream.h>

inline void* operator new(size_t, void* ptr) { return ptr;}

class Elem{
public:
Elem(int a)
{
data = a;
}

public:
int getData()
{
return data;
}

private:
int data;
};

void main()
{
int* pint = new int[2 + sizeof(Elem)];
(void)new (pint) Elem(10);
Elem* elem = (Elem*)pint;
cout << elem->getData() << endl;
delete pint;
}
GeneralRe: Question about new operator. Pin
Hans Ruck31-Jan-03 1:00
Hans Ruck31-Jan-03 1:00 
GeneralRe: Question about new operator. Pin
George231-Jan-03 3:16
George231-Jan-03 3:16 
GeneralRe: Question about new operator. Pin
Hans Ruck31-Jan-03 3:35
Hans Ruck31-Jan-03 3:35 
GeneralRe: Question about new operator. Pin
George231-Jan-03 4:28
George231-Jan-03 4:28 
GeneralRe: Question about new operator. Pin
Anonymous31-Jan-03 5:18
Anonymous31-Jan-03 5:18 
GeneralRe: Question about new operator. Pin
George231-Jan-03 17:52
George231-Jan-03 17:52 
GeneralWIN32 SDK : GetWindowDC works, GetDCEx doesn't Pin
30-Jan-03 23:11
suss30-Jan-03 23:11 
GeneralReplacing and resizing of the controls in formview to bestfit of Monitor on change system resolution Pin
sulaxan30-Jan-03 22:11
sulaxan30-Jan-03 22:11 
QuestionAny good references? Pin
dsuratman30-Jan-03 20:57
dsuratman30-Jan-03 20:57 
AnswerRe: Any good references? Pin
LittleYellowBird30-Jan-03 23:51
LittleYellowBird30-Jan-03 23:51 
AnswerRe: Any good references? Pin
Abbas_Riazi31-Jan-03 0:13
professionalAbbas_Riazi31-Jan-03 0:13 
AnswerRe: Any good references? Pin
Lhenno Ferrari31-Jan-03 0:22
Lhenno Ferrari31-Jan-03 0:22 
GeneralRe: Any good references? Pin
Lhenno Ferrari31-Jan-03 1:01
Lhenno Ferrari31-Jan-03 1:01 
GeneralToolbar Pin
satyavasu30-Jan-03 19:52
satyavasu30-Jan-03 19:52 
GeneralRe: Toolbar Pin
dsuratman30-Jan-03 20:59
dsuratman30-Jan-03 20:59 
Generalsdi app starts minimized Pin
bryce30-Jan-03 19:00
bryce30-Jan-03 19:00 
GeneralRe: sdi app starts minimized Pin
ROK_RShadow30-Jan-03 19:17
ROK_RShadow30-Jan-03 19:17 

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.