Power (Re: all those :-)

Eddie Wyatt edw at IUS1.CS.CMU.EDU
Fri Jan 29 01:16:36 AEST 1988

In article <3521 at ihlpf.ATT.COM>, nevin1 at ihlpf.ATT.COM (00704a-Liber) writes:
> Then where is the operator for string concatenation, and square root, and
> everything other binary function that is used by C programmers? 

Why not? why not have an extendable language, where the user is free to 
define his own infix operators?  Is it that outragous?  

> .		#define sqr(x)		((x)*(x))

> Let me rephrase objection number 2:  Here is a bad macro for defining squaring.
> Since the macro given doesn't work in all cases, a power operator should be
> added to C.  [This is my opinion of objection #2]

   No this is not my objection.  My objection is that even in cases that
the macro does evaluate the correct value with no adverse side effects,
there are other subtilties.  Which is in this case the amount of work needed
to calcuated the square.

> This is not good enough reasoning in my book!  As I suggested before, you need
> temp variables to get this macro right!  Don't add features to the language
> just because some programmers don't know how to get it right!

  	I know that the macro won't work in all situations, I don't think you
can write one that will work in all situations.  So o.k. I'm game, what's
"the right" way to write the macro.  :-/  


Eddie Wyatt 				e-mail: edw at ius1.cs.cmu.edu

More information about the Comp.lang.c mailing list