View Single Post
Old 20-06-16, 18:52   #1927
Cochrane
Golden
 
Cochrane's Avatar
 
Joined: Apr 2006
Posts: 16,751
Default

C99 would have been great. It's actually closer to C89, what with declaring every variable at the start of the function. But every file is declared as a C++ file, generally for no apparent reason, which makes it technically whatever version of C++ the compiler defaults to (C++03 or higher). My guess is that this was to use the vt loader code, which was from a different open source project and had always been C++. So it's a bit confusing. And then there's things like the three-thousand-line switch statement from hell in anim_state_control.cpp, which still gives me nightmares. It's quite a fascinating sight to behold.

I don't mean to mock any of this; what TeslaRus did has been consistently amazing. But in terms of style, this is really not an easy codebase to get the hang of if you're not TeslaRus yourself. I'm not sure anyone's actually managed to understand all or most yet; my guess is Lwmte and stohrendorf might.

Getting this thing cleaned up was and remains a very important effort. It's not that important whether it's C++ or C99 or whatever (but not Java. And I'm saying this as a professional Java developer), as long as it clearly separates concerns, splits things into their own files with clear interfaces, and gets rid of all the duplication in so many parts of the code.

In retrospect, that's probably where we should have started, not with porting everything to "C++ style" and then trying to clean it up. But going with "really good C++" everywhere seemed like the "obvious" place to start. It certainly did to me; I started my own branch like that, but never finished or published it because I was too lazy. So I supported the effort to turn everything C++, and then became one of the developers who was for C++ but never did anything with the C++ code, because it hadn't solved any of the original problems, just introduced new ones (including merge conflicts and the whole build system thing). Sorry about that.

Anyway: The language that TeslaRus works in is essentially C89, but run through a C++ compiler (so technically C++03) to get access to some C++ headers, and of course some of the standard extensions (the two slashes comment syntax).

Last edited by Cochrane; 20-06-16 at 18:54.
Cochrane is offline   Reply With Quote