|
From: Lane R. <la...@if...> - 2004-11-30 16:57:51
|
on Tue, Nov 30, 2004 Roger Holmes may have said: >> One of the major problems on the games we see on the games we port is >> that CW/gcc do a terrible job of keeping simple C++ objects like a >> vector tuple in registers - so overloading "+" to give you a vector >> addition for "x + y" will often generate truly dire code compared to >> adding the fields yourself. > >But the code is so much more readable, computers are getting faster >all the time and compilers are becoming more efficient. Microspot >could not maintain big chunks of 3DWorld without operator overloading. >A single line of code would have to become a dozen statements with >temporary variables, awkwardly named procedure calls with & operators >spread about all over the place. As you say, 'everyone feels differently >about what's good and what's bad about C++'. How do you other >guys think about operator overloading for vectors, points and matrices=3F Having worked on a lot of code, operator overloading is one of my biggest complaints. Beyond speed (Quesa isn't a speed deamon, requiring 100% of the CPU on a 2.6Ghz machine to render 75 fps in Bugdom!) I find such code much harder to maintain. It is probably true that for the original programmer it's easier; but when someone knew comes in it simply hides too much very important information. >could not maintain big chunks of 3DWorld without operator overloading. >A single line of code would have to become a dozen statements with >temporary variables, awkwardly named procedure calls with & operators >spread about all over the place Why=3F Any operation that you would want to overload should be able to become an inlined function call just as easily. The actual operation code remains nearly identical. (at least in my experience.) =46rom someone who's still trying to get the latest builds to work in my products, I'd rather see easily read/understood/maintainable code. The more programmers who can read the code and =5Freally=5F understand what's happening the more contributions to that code base you will get. My experience says that OS projects benefit more from source that is well documented and easy to figure out than source that "does things the right way" (no matter which way that is!) The more templates, overridden operators and virtual doubly inherited functions you have the more time it will take a new coder to figure out the source in order to work on it and the less likely that coder will be to contribute. Just my experience from several open source projects. Of course, if the main programmers on a project are not happy with the way the source is being worked on the project is certainly dead; so ... :) Before I forget, Thanks Dair ... without your work two of my products would not have even been possible :) Lane Roathe President Ideas From the Deep <http://www.ifd.com> =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F= =5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F=5F Since the Internet has no walls or fences, who needs Windows or Gates=3F |