Click here to Skip to main content
16,019,199 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Help? Anyone? Pin
Christian20-Oct-00 15:13
Christian20-Oct-00 15:13 
GeneralVertical rebar problems (CReBar) Pin
John Otken17-Oct-00 11:01
John Otken17-Oct-00 11:01 
GeneralI want opinions/views Pin
#realJSOP17-Oct-00 2:04
professional#realJSOP17-Oct-00 2:04 
GeneralRe: I want opinions/views Pin
GBO17-Oct-00 6:42
GBO17-Oct-00 6:42 
GeneralRe: I want opinions/views Pin
#realJSOP18-Oct-00 0:53
professional#realJSOP18-Oct-00 0:53 
GeneralRe: I want opinions/views Pin
GBO18-Oct-00 2:26
GBO18-Oct-00 2:26 
GeneralRe: I want opinions/views Pin
#realJSOP18-Oct-00 4:32
professional#realJSOP18-Oct-00 4:32 
GeneralRe: I want opinions/views Pin
GBO18-Oct-00 5:05
GBO18-Oct-00 5:05 
> I think memory usage would be close (if not identical) because we are talking about a given struct within a finite array.

~ Correct.

> As for speed, I don't know if that would matter until we were talking about thousands of elements or hundreds/thousands or new/delete pairs.

Actually, calling X times an allocation/de-allocation routine is almost ~X times slower than calling it once with a X-time larger memory chunk (provided it doesn't trash the OS). cfr. a good OS internals book, e.g. http://www.sysinternals.com/insidew2k.htm

> And yes, I obfuscate my code like this all the time, and no, I wasn't trying to embarass anyone.

Blush | :O Phew, thanks.

Since we are on a roll here: Do you want to stick your neck out? Try this one:
Write down the output of the listed program without compiling and running it. Then check the results...
But then again, of course, you do this in a jiffy. Big Grin | :-D

class foo
{
public:
foo() {}
virtual ~foo() {}
virtual void Print(void)
{
cerr << "it's foo!\n";
}
void Print(int err)
{
cerr << "it's foo with err : " << err << "\n";
}
};

class childfoo1 : public foo
{
public:
childfoo1() {}
~childfoo1() {}
void Print(void)
{
cerr << "it's childfoo1!\n";
}
void Print(int err)
{
cerr << "it's childfoo1 with err : " << err << "\n";
}
};

class childfoo2 : public foo
{
public:
childfoo2() {}
~childfoo2() {}
void Print(void)
{
cerr << "it's childfoo2!\n";
}
void Print(int err)
{
cerr << "it's childfoo2 with err : " << err << "\n";
}
};

// which Print function is called ??
int main(void)
{
foo * foopointer1 = new childfoo1();
foo * foopointer2 = new childfoo2();
foo * foopointer3 = (childfoo1*) foopointer2;
childfoo1 * foopointer4 = (childfoo1*) foopointer2;

cerr << "\n1 ";
foopointer1->Print();
cerr << "\n2 ";
foopointer2->Print();
cerr << "\n3 ";
foopointer3->Print();
cerr << "\n4 ";
foopointer4->Print();

cerr << "\n5 ";
foopointer1->Print(5);
cerr << "\n6 ";
foopointer2->Print(5);
cerr << "\n7 ";
foopointer3->Print(5);
cerr << "\n8 ";
foopointer4->Print(5);

delete foopointer1;
delete foopointer2;
return 0;
}
GeneralRe: I want opinions/views Pin
Erik Funkenbusch17-Oct-00 9:54
Erik Funkenbusch17-Oct-00 9:54 
GeneralRe: I want opinions/views Pin
Andrei Zenkovitch18-Oct-00 6:27
Andrei Zenkovitch18-Oct-00 6:27 
GeneralMenu Pin
toby17-Oct-00 0:57
toby17-Oct-00 0:57 
GeneralRe: Menu Pin
frydaysoft17-Oct-00 1:24
sussfrydaysoft17-Oct-00 1:24 
GeneralRe: Menu Pin
Erik Funkenbusch17-Oct-00 9:59
Erik Funkenbusch17-Oct-00 9:59 
GeneralRe: Menu Pin
Roger18-Oct-00 1:42
Roger18-Oct-00 1:42 
GeneralProblem with drag and drop Pin
Juan Diego Domínguez17-Oct-00 0:46
Juan Diego Domínguez17-Oct-00 0:46 
Questionhow to change the text color and background color of a combo box Pin
Mac17-Oct-00 0:30
Mac17-Oct-00 0:30 
AnswerRe: how to change the text color and background color of a combo box Pin
frydaysoft17-Oct-00 1:17
sussfrydaysoft17-Oct-00 1:17 
GeneralMFC -> COM, ActiveX Pin
RK16-Oct-00 12:34
RK16-Oct-00 12:34 
GeneralRe: MFC -> COM, ActiveX Pin
Bashir Irfan Malik16-Oct-00 22:27
Bashir Irfan Malik16-Oct-00 22:27 
GeneralRe: MFC -> COM, ActiveX Pin
RK17-Oct-00 9:31
RK17-Oct-00 9:31 
GeneralBitmap Display Problems Pin
Frederic Katz16-Oct-00 9:31
sussFrederic Katz16-Oct-00 9:31 
GeneralRe: Bitmap Display Problems Pin
Remus Lazar16-Oct-00 22:38
Remus Lazar16-Oct-00 22:38 
General#How to get the file path of my finished program in the code?# Pin
Fredrik16-Oct-00 0:10
Fredrik16-Oct-00 0:10 
GeneralRe: #How to get the file path of my finished program in the code?# Pin
#realJSOP16-Oct-00 0:55
professional#realJSOP16-Oct-00 0:55 
GeneralThanks, that worked like a charm! :) (NT) Pin
Fredrik16-Oct-00 21:38
Fredrik16-Oct-00 21:38 

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.