View Single Post
  #44  
Old February 26th, 2004, 08:54 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 alexti:
The idea of the standards is to be able to write code which will work correctly (meaning that as programmer specified in the source code - as opposite to what the programmer wants ) if compiled by any standard-compliant compiler.
The C/C++ standards do not address the issue that's been the focus of this interminable discussion. So your argument is sort of irrelevant.
Quote:
Optimizer should meet all criteria defined in the language standard concerning the produced binary code, so the only case when it is allowed to alter the results is when the programmer is using constructs which behaviour is undefined by the standard. And the programmer should not be using such constructs.
1) The compiler does comply with the standard. 2) The side effect is not anticipated by the standards. 3) The construct is perfectly legal. But it assumes things. Bad things. (An analogy is writing code that depends on the bit-order of the hardware it's running on. A real bad no-no.) It's the responsibility of programmers to understand what their code is intended to do, and how the compiler will do its task, and whether there's a conflict between his/her intentions and its results. It's not the job of standards to protect programmers from themselves. (That's what good teachers, lots of reading, and not getting in the habit of sloppy coding is for. )
__________________
Visit my Dominions II site
Reply With Quote