ID Software was not known for writing what could be called "portable"
software. At the very least in CLC the idea is code snippets should
be portable.
fair enough...
with some modest modifications, I had it working on Windows x64 before.
I later briefly tried building this version on Linux x86-64, but it
tended to crash when doing "new game" (and then managed to effectively
break X11 requiring a hard-reboot), and at the time I didn't really
bother enough with trying to use GDB to make it fully work (one can get
spoiled with things like the Visual Studio debugger and similar...).
and, people have also got it working on a number of exotic
architectures, so its portability probably isn't that terrible.
I have my own 3D engine (vaguely Quake-like, but written clean so as to
hopefully be free of the GPL, and internally working somewhat
differently), which does build and work on Linux x86-64 at present, but
does have a few theoretical technical issues (the theory goes that
calling variable-argument C functions from my custom script-language
"should" be prone to misbehave/blow-up due to how varargs and the AMD64
ABI are handled at present, and I would have to partly rework the
existing function-call mechanism to fix this...). currently, it calls
the functions with garbage in the variable arguments.
I may later integrate "printf" directly into my script-VM (as a builtin
function), since I call it a lot from scripts, and this is the main
function likely to encounter this issue, but Linux is not a highly
important target at the moment, so I may address this when I get to it.
also, lots of work and debugging is needed in general.
whether or not though I can create a complete game though is another
issue, as there is a lot of work needed in areas I am not very good
enough (mostly "content creation" type issues), before one has something
which anywhere compares with anything people would probably willingly
pay money for (and not feel ripped off...).
I think the above code is correct [portable] just not very useful and
as a design decision I'd avoid that sort of declaration/initialization
code.
yes, ok.
I'm also not a big fan of code like
int a=4,b,c,d=5;
// etc...
I think legibility is increased if declarations are in one block, and
initializers in another...
int a,b,c,d;
a = 4;
d = 5;
// code...
agreed, I tend to do similar...
As a general rule aside from going crazy on the prettyness every
minute spent writing proper code is 5 minutes saved on debugging.
Being able to quickly scan code for "is this variable initialized and
if so to what?" is very handy.
I try to make tradeoffs...
prettyness, good style, ... matter some, but ultimately, getting things
written and working is a better strategy.
for example, "perfect" code is of little value if it is never written or
put to use. often, code can be just plain nasty, and the product still
gets written and working (the horrible nastiness just left for whoever
dares look at the source).
but, ideally, a person can still try to make the code look nice where
possible.