Expressions in initializers

Henry Spencer henry at zoo.toronto.edu
Wed Mar 6 03:25:57 AEST 1991


In article <17294 at crdgw1.crd.ge.com> volpe at camelback.crd.ge.com (Christopher R Volpe) writes:
>"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?

If <math.h> has been included, an ANSI C compiler may well have been
informed, by magic in it, that sqrt means "square root".

>I could have in another file:
>double sqrt(double x)
>{

Naughty, naughty.  The external identifiers in the ANSI C library, including
sqrt, are reserved; you redefine them at your peril.
-- 
"But this *is* the simplified version   | Henry Spencer @ U of Toronto Zoology
for the general public."     -S. Harris |  henry at zoo.toronto.edu  utzoo!henry



More information about the Comp.lang.c mailing list