Yes, the language in both standards is horrible! :-/
AFAICS, all that stuff about the "defining point" for functions is probably just saying that you can use predefined functions only (excluding those that don't have a constant result) and not functions that you define within your program.
Joe.
-----Original Message----- From: Emil Jerabek [SMTP:ejer5183@artax.karlin.mff.cuni.cz] Sent: Friday, February 08, 2002 4:33 AM To: gpc@gnu.de Subject: Re: Constant Expressions (was: Complex_Arctan)
Joe wrote:
Please see below ...
Joe. ( Feeling a bit better :-)
Good news :-)
Well, actually the ISO-10206 standard (since the topic was complex maths, that is the applicable standard) *does* allow function calls in constant expressions. See sections 6.3.1, 6.3.2, 6.8.2. :-)
There are some restrictions of course, mainly to ensure that the constant expression is indeed constant. AFAIK, only pre-defined functions are allowed (although I haven't looked too closely at that).
Example from section 6.3.2 :
const ............... pi = 4 * arctan(1); ...............
You are probably right. I got somewhat confused by the language of the standard ;-)
From section 6.8.2:
"...An expression shall be designated nonvarying if it does not contain the following ... c) an applied occurrence of an identifier as a function-identifier that has a defining-point contained by the program-block or that denotes one of the required functions eof or eoln. ..."
Section 6.2.2.1:
"Each identifier or label contained by the program-block shall have a defining-point, with the exception of the identifier of a program-heading (see 6.12)."
From section 6.2.2.10:
"Required identifiers that denote the required values, types, schemata, procedures, and functions shall be used as if their defining-points have a region enclosing the program (see 6.1.3, 6.4.2.2, 6.4.3.4, 6.4.3.6, 6.4.3.3.3, 6.7.5, 6.7.6, and 6.10). ..."
So, do those required identifiers have a defining-point or do they not?
Emil Jerabek