Expressions in initializers

Christopher R Volpe volpe at camelback.crd.ge.com
Tue Mar 5 07:14:29 AEST 1991


In article <1991Mar4.144939.8311 at ux1.cso.uiuc.edu>,
mcdonald at aries.scs.uiuc.edu (Doug McDonald) writes:
|>sqrt(2.0) is an expression. It CAN be evaluated at compile time. Perhaps
|>some people don't want to write compilers that do that (i.e. they are too
|>lazy), but it most certainly CAN be evaluated.

"The square root of two" can be evaluated at compile time, but "sqrt(2.0)"
is an invocation of a function. How is the compiler supposed to know
what sqrt is? I could have in another file:

double sqrt(double x)
{
  return x - 1.0;
}
                              
==================
Chris Volpe
G.E. Corporate R&D
volpecr at crd.ge.com



More information about the Comp.lang.c mailing list