Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!rutgers!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!rpi!batcomputer!munnari.oz.au!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.c Subject: Re: prototyping (oh no! not again??) Message-ID: <4402@goanna.cs.rmit.oz.au> Date: 29 Nov 90 06:25:27 GMT References: Distribution: comp Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 28 In article , davis@pacific.mps.ohio-state.edu ("John E. Davis") writes: > Also, what C lacks is something as the fortran ** operator. Why can't this be > implemented as a binary operator say as x^y. For the same reason that SIN isn't a unary operator in Fortran, even though mathematicians use "sin x" in preference to "sin(x)". Let's face it, Fortran hasn't a MOD operator! (All together now, let's flame Fortran for not having something as basic as "%".) The answer is: either you go the APL route of making _everything_ an operator, or you draw a line somewhere and say "this has the syntax of an operator, that has the syntax of a function call". That choice has *NO* consequences for how the implementation works. In this particular case, "^" already *is* an operator in C, meaning bit-wise exclusive or. > I am not sure what the pow function does. Why not check a manual and find out before complaining that C hasn't got an equivalent of **? In ANSI C, if you have done #include there is no significant non-syntactic difference between pow() and ** . An ANSI C compiler is fully entitled to compile x = pow(y, 2); /* I _did_ say ANSI! Pre-ANSI needs 2.0 */ as x = y*y; Is this in the FAQ? -- I am not now and never have been a member of Mensa. -- Ariadne.