View Single Post
  #18  
Old February 25th, 2004, 11:12 PM
Arryn's Avatar

Arryn Arryn is offline
Major General
 
Join Date: Jan 2004
Location: twilight zone
Posts: 2,247
Thanks: 0
Thanked 0 Times in 0 Posts
Arryn is on a distinguished road
Default Re: 2.08 and Incompatible Battle Reports

Quote:
Originally posted by Saber Cherry:
quote:
Originally posted by PhilD:
Don't use two function calls in the same expression, is the lesson.
Compliers do strange things. A poorly-written compiler could rearrange consecutive lines if there is no obvious dependancy.

1: a=2d6+penetration
2: b=2d6+mrst
3: if(a>b){do c}

Lines 1 & 2 could be rearranged by a compiler if, for example, mrst is more local (already in a register) and penetration has to be fetched. That would have the same effect. I think C has some commands that let you force the complier to not rearrange things, though.

So the moral is actually not to trust Microsoft products, since they take away your control

Having done quite a bit of compiler beta-testing in my younger days, what this basically amounts to is an issue of (no offense to IW intended) somewhat sloppy coding practice by programmers. If you want to force the compiler to evaluate things a certain way, then make liberal use of parenthesis and local-scope intermediate variables. But what I see all too often is programmers that try to cram as much code as possible into a single line. That's just begging for trouble. And it's an absolute no-no when writing cross-platform code.

BTW, the MSVC compiler is actually very good. A bit odd at times, but good nonetheless. You just have to be very well acquainted with all it's various switches, directives, etc. The compiler doesn't really take control away from you. It's settings default to newbie usage. Which can be overridden. And should be, by professional coders.

My $0.02 worth on the subject.
__________________
Visit my Dominions II site
Reply With Quote