Message from discussion
Why C is much slower than Fortran
From: Robert Harley <har...@corton.inria.fr>
Subject: Re: Why C is much slower than Fortran
Date: 1999/05/03
Message-ID: <99-05-011@comp.compilers>#1/1
X-Deja-AN: 473606016
Approved: compil...@iecc.com
Sender: jo...@iecc.com
References: <3710584B.1C0F05F5@hotmail.com> <7esvkr$v8g$1@camel29.mindspring.com> <37122569.BF79CD19@hotmail.com> <3712311D.BA9027D4@hotmail.com> <7etenl$nk5$1@alexander.INS.CWRU.Edu> <99-04-048@comp.compilers> <99-04-105@comp.compilers> <99-04-107@comp.compilers>
X-submission-address: compil...@iecc.com
X-moderator-address: compilers-requ...@iecc.com
Organization: I.N.R.I.A Rocquencourt
Keywords: C, performance
Newsgroups: comp.lang.c++,comp.compilers
X-FAQ-and-archives: http://www.iecc.com/compilers
Our moderator wrote:
> C lets you alias anything to anything, and that does indeed cause
> optimization problems. The C9X draft has a "restrict" keyword [...]
But ANSI C has a rule which disallows aliasing anything to anything!
The rule is that an object in memory can only be accessed through
lvalues of the same type, possibly in a struct or union, or of char
type (here the types are considered modulo signed/unsigned and
qualifiers).
Presumably the "alias=typed" flag uses this rule to optimise better.
The restrict keyword can be used to give extra aliasing information,
even between objects of the same type where ANSI aliasing does not
help.
Bye,
Rob.