The International Simutrans Forum

Simutrans Extended => Simutrans-Extended bug reports => Simutrans-Extended development => Simutrans-Extended closed bug reports => Topic started by: neroden on December 05, 2011, 04:48:15 AM

Title: Serious compilation bugs (fixed)
Post by: neroden on December 05, 2011, 04:48:15 AM
Your 10.x branch doesn't compile with GCC under Linux, and as a result neither do any of your other branches.

The recurring problem is that you are taking addresses of temporaries, which is prohibited.

I fixed one of these problems (in vehicle/simvehikel.c) correctly. 

You should not be passing koord3d by pointer in any case; passing it by value should be sufficiently efficient with optimizing compilation; if you don't like passing it by value, pass it by reference.  There's a rule of thumb; once you put a pointer into a method signature, you're stuck forever, and it becomes impossible to pass raw data to the method without using a global or static variable -- so don't do it unless that's acceptable (if the method is operating on pointer-based data structures, for instance, and can't accept raw data anyway).

I fixed the other problem, in  simhalt.cc, with brute force, removing a sanity check, because I couldn't figure out what you were doing; the types were perplexing.  But hey, it compiles now.

Please pull from my jp-10x branch, which constains these crucial fixes.  (Then look at simhalt.cc and figure out what you were trying to do, and do it without taking the address of a temporary.)

P.S. I won't be able to work on simutrans much because I'm learning calculus of variations, but at least I can keep it compiling.  :-)
Title: Re: Serious compilation bugs (fixed)
Post by: Dwachs on December 05, 2011, 05:08:56 PM
Quote from: neroden on December 05, 2011, 04:48:15 AM
P.S. I won't be able to work on simutrans much because I'm learning calculus of variations, but at least I can keep it compiling.  :-)
Don't trust Dirichlet's principle !!!!!!
Title: Re: Serious compilation bugs (fixed)
Post by: jamespetts on December 06, 2011, 12:30:40 AM
Nathaneal,

thank you very much for this - I have incorporated this as suggested. Can you test to see whether my running-powers branch compiles properly on Linux now? Thank you again!