Re: constant expressions

Hans-Peter Diettrich <DrDiettrich1@aol.com>
Thu, 15 Jan 2009 02:32:06 +0100

          From comp.compilers

Related articles
constant expressions gah@ugcs.caltech.edu (glen herrmannsfeldt) (2009-01-13)
Re: constant expressions DrDiettrich1@aol.com (Hans-Peter Diettrich) (2009-01-15)
Re: constant expressions gneuner2@comcast.net (George Neuner) (2009-01-16)
| List of all articles for this month |
From: Hans-Peter Diettrich <DrDiettrich1@aol.com>
Newsgroups: comp.compilers
Date: Thu, 15 Jan 2009 02:32:06 +0100
Organization: Compilers Central
References: 09-01-031
Keywords: code, optimize
Posted-Date: 15 Jan 2009 05:37:06 EST

glen herrmannsfeldt schrieb:


> I know compilers have done compile time evaluation of scalar constant
> expressions for many years. I wonder about the state of the art in
> compile time evaluation of constant array expressions. I would
> include the case of arrays in initialized variables that are known at
> compile time not to change.


It's a matter of the operations, that are allowed in constant
expressions. When array member selection is considered such a
"constant operation", then a compiler has to implement indexing into
constant arrays as part of the evaluation of constant expressions.


> Do any compilers now do compile time
> evaluation of complicated array expressions?


The "constant expression evaluator" can be seen as part of a
compiler, interpreting any expression and returning both a flag,
whether the expression really was a constant expression, and, if true,
also returning the according constant value.


DoDi



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.