Originally Posted By: rayp
Edit: Ah i forgot about writing a Compiler and and...what a work !

See, that is the point where I think Gamestudio went wrong. Writing a compiler is a task that you don't want to do. If you think writing a game engine or a kernel is a crazy idea; Writing a compiler tops that in a heartbeat.
Yeah, a piss compiler like the Lite-C one, that's possible in a year or so, but one that actually works and that generates good code? A lot of people with really fancy degrees spend years on optimizing compilers like LLVM/Clang, writing single optimization passes like the new loop vectorizer which take advantage of the specific architecture the code is compiled for and some very specific edge cases.
Writing a compiler that generates good binaries is a daunting task, there are so many things that may slow down the execution, so many things that can be optimized... It's not feasible, don't do it.

To add some perspective to this, the HEAD of the Rayne repository currently tracks 1552 commits made by 4 people (the initial commit was made on december 8th last year, if anyone wants to know), and consists of 59080 lines of code spread over 229 files (all of this is just the engine core, not Downpour or any plugins or third party vendor code).

The latest Clang core (just clang, not LLVM!) version I just checked out from SVN has 191020 commits and 1261859 lines of code spread over 7349 files. This is "just" the compiler C/C++/Objective-C front end.
Moral of story: Don't write your own compiler.

Yeah, I realize, LLVM/Clang wasn't around when A7 was made and MSVC is closed, so it can't be hacked to support the Gamestudio quirks like wait(), and GCC... Well, it's mostly undocumented spaghetti code.
Looking back, I'd say the biggest mistake JCL made was the Compiler. Just look around, it only supports a very limited subset of the C standard and has a tremendous amount of bugs that will probably never see any kind of fixing. And it doesn't optimize anything.

This is probably what's taking the android port so long, because now the Lite-C compiler has to support a completely different ABI and architecture.

Edit (because I like rambling about this topic): Of course the problem you end up with when you don't ship your own compiler is fragmentation. Linux/Android uses GCC, Windows uses either GCC or MSVC and OS X/iOS is LLVM/Clang. The compiler on all platforms are moving targets, and the C++ ABI isn't standardized, so you end up having to compile your project with all compilers you want to support for all platforms (ie x86 and x86-64), just to get these damned things to link nicely together.

Last edited by JustSid; 09/19/13 18:02.

Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com