|
|
|
 |

February 27th, 2004, 02:13 AM
|
First Lieutenant
|
|
Join Date: Dec 2003
Location: Calgary, Canada
Posts: 762
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Re: 2.08 and Incompatible Battle Reports
Quote:
Originally posted by Arryn:
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. That's exactly the point. If C/C++ standard does not specify the order of evaluation (I haven't seen it there, but it doesn't mean that it's not there though ) you can not rely on any particular order.
In the following example you can't rely on whether left call or right call will be evaluated first, but you can rely that both of them will be evaluated.
code:
int print_empty_line()
{
printf("\n");
return 1;
}
void foo(int x)
{
if (x + print_empty_line() < 2 + print_empty_line())
...
}
Quote:
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.
Which case you considering? Concerning evaluation order it's standard-compliant, but if it replaces 2 calls with one, it's not.
|

February 27th, 2004, 02:21 AM
|
First Lieutenant
|
|
Join Date: Dec 2003
Location: Calgary, Canada
Posts: 762
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Re: 2.08 and Incompatible Battle Reports
Quote:
Originally posted by E. Albright:
quote: Originally posted by alexti:
Some Languages consider line feeds as a language element, but not C/C++.
code:
f(); f();
and
code:
f();
f();
are the same thing.
|
Fair enough. However, Arryn was suggesting that your example was not analogous because the calls were in seperate statements (tho' to be fair, she used the term "lines", so the confusion is understandable).
Here's where those examples came from:
Quote:
Originally posted by Arryn:
[qb]The problem comes in that the compiler's optimization will substitute the same call to the random number function for both die rolls. It won't make the two rand() calls the coders intend. What it does is make one call and plug the same value into both places. The optimizer does not know that in this circumstance, two calls to the same function do not return the same value.
|
And in all 3 cases f shall be called twice:
code:
f(); f();
f(), f();
f()+f()
Edit: Fixed quotations. Again.
P.S. I want real forum/client 
[ February 27, 2004, 00:23: Message edited by: alexti ]
|

February 27th, 2004, 04:06 PM
|
 |
Shrapnel Fanatic
|
|
Join Date: Oct 2003
Location: Vacaville, CA, USA
Posts: 13,736
Thanks: 341
Thanked 479 Times in 326 Posts
|
|
Re: 2.08 and Incompatible Battle Reports
OK master password is in now, but has anyone tried using it? I take it that it is only to override the player passwords? No AI access? I was hoping it would let me jump in midgame to check on what an AI was doing.
__________________
-- DISCLAIMER:
This game is NOT suitable for students, interns, apprentices, or anyone else who is expected to pass tests on a regular basis. Do not think about strategies while operating heavy machinery. Before beginning this game make arrangements for someone to check on you daily. If you find that your game has continued for more than 36 hours straight then you should consult a physician immediately (Do NOT show him the game!)
|

February 27th, 2004, 05:26 PM
|
Sergeant
|
|
Join Date: Dec 2003
Posts: 201
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Re: 2.08 and Incompatible Battle Reports
Quote:
Originally posted by Gandalf Parker:
DISCLAIMER Im just kidding.
There are no mismatched battle reports. You all just have cowardly messengers. "Ummm you won. Yeah thats it, YOU WON oh Mighty and Frightening Deity."
I dont have that problem. But then I usually take wimply little mages. I dont take big scarey two-headed snakes, or giant floating heads.
|
My messengers wouldn't dare report anything but the Truth ! First, it is official dogma that I, as a Pretender, am All-Knowing, therefore any effort at lying will be found out. And all my citizens are true believers of official dogma. Second, it is equally well known that bad news only result in a quick and painful death, while lying result in an eternal and even more painful afterlife. And finally, my majordomo knows that I don't like to be bothered by unsignificant events...
Of course, it helps that I never lose a battle, and that there are never bad news to report. And it helps that I have a first-class majordomo.
(Tacticus Sanguinus, God of Mictlan)
|

March 5th, 2004, 02:11 AM
|
 |
Brigadier General
|
|
Join Date: Aug 2003
Location: Mictlan
Posts: 1,767
Thanks: 12
Thanked 165 Times in 22 Posts
|
|
Re: 2.08 and Incompatible Battle Reports
Quote:
Originally posted by alexti:
And if using MSVC5/6 one can optimize for size, it often produces faster code then optimization for speed (even if speed-optimized executable is sort of working).
|
I tried it and 'Minimize size' actually resulted in a faster program than 'maximize speed' (about 1% faster). Who would have guessed. I bet 'minimize size' makes it larger though 
|

March 4th, 2004, 03:23 PM
|
First Lieutenant
|
|
Join Date: Dec 2003
Location: Calgary, Canada
Posts: 762
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Re: 2.08 and Incompatible Battle Reports
|
Thread Tools |
|
Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is On
|
|
|
|
|