Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: About compiler optimizations

Author: Dieter Buerssner

Date: 12:49:52 12/20/02

Go up one level in this thread


On December 19, 2002 at 17:59:46, Eugene Nalimov wrote:

>The following is part of the ANSI/ISO C++ Standard (section 3.10, clause 15):
[...]
>I don't have C standard nearby, but it contains something similar.

Yes.

>Unfortunately, lot of real-world C/C++ code violate that part of the standard.

Sure. I hope, my code doesn't use such things. My understanding was that the
"assume no alias optimization" switches of Compilers will also apply to Standard
conform usage of the language. A gave a very small and primitive example, in the
answer to Bob. ON CPUs with many registers, sometimes Fortran numerical code is
better optimized than C code. The Fortran compiler can keep things in registers,
which the C-Compiler can't, when pointers are involved, because it in general
will not know, if some writing to an adress will invalidate the register. Of
course, in many cases, this can be worked around by some temporary variables.
Or, in C99 probably with restricted. My understanding was, that with those
optimization switches, you allow the C-compiler using similar optimizations as a
Fortran compiler. And, for some code, this would certainly fail (any memmove
alike code, for example).

Regards,
Dieter



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.