Date: Mon, 23 Dec 1996 10:32:02 -0500 Message-Id: <199612231532.KAA18130@delorie.com> From: DJ Delorie To: R DOT L DOT F DOT v DOT Paasen AT stud DOT tue DOT nl CC: djgpp AT delorie DOT com In-reply-to: <32B0AC9A.3ABB@stud.tue.nl> (R.L.F.v.Paasen@stud.tue.nl) Subject: Re: Allegro future > I agree this time. The speed of compiled C++ code depends on the > complexity of your class hierarchies. Overloading, lots of virtual > functions, copy constructors and that sort of things are > slow-downers. Copy constructors are the big hits. Pay careful attention to these! Virtual functions add only a few cycles per call (two pointer dereferences and an add, I think), regardless of your class structure. Function overloading is done at compile time and does not incur a runtime hit. > Most C/C++ compilers however allow C and C++ code to be mixed. It > won't hurt to use C++ code in your C program or vise versa, as long > as you keep an eye on performance. For example, I write in C++ most of the time (djgpp is an exception), but I always use printf instead of cout (for various reasons). > But hey, if you really want fast code, you should be concerned about > efficient software design, optimizing algorithms and clever data > structures. Two other concerns that C++ addresses is; 1) The code is easier to design and write when you have appropriate tools. 2) Cleaner designs result in easier maintenance. I've also noticed that if you can come up with a cleaner design, you can often *reduce* the amount of code needed to run it.