C++ digraph <>

Thomas M. Breuel uunet!ai.mit.edu!tmb
Wed Nov 27 20:55:13 PST 1991


|> |<>	less or greater
|> |!<>=	unordered
|> |<>=	less, greater, or equal
|> |!<=	unordered or greater
|> |!<	unordered, greater, or equal
|> |!>=	unordered or less
|> |!>	unordered, less, or equal
|> |!<>	unordered or equal
|> |[...]
|> 
|> I think it is a bad idea to litter the namespace with these
|> rather specialized operators. What would be wrong with simply
|> providing functions:
|> 
|> 	int less_or_greater(float a,float b);
|> 	int unordered(float a,float b);
|> 	int unordered_or_greater(float a,float b);
|> 	...

First, let me remark that my reply wasn't to the whole list, but since
Rex has forwarded and brought it into a public forum, let me reply
publically...

|It's the same issue as what's wrong with add_complex(c1, c2). C++ provides 
|operator overloading so you can use the more intuitive  c1 + c2. We have 
|looked at function notation versions a lot and intrinsic functions in 
|general.

Using operator+ for addition of complex numbers makes sense, since it
is the usual mathematical notation and therefore intuitive; if I didn't
know what the notation for complex addition was, that would be my first
guess in any language. I find nothing that is similarly intuitive about
"!<>=".

C++ has been very conservative in adding new operators, and I think
this conservativism is justified. C notation is already rather terse
and difficult to read, and I can see little justification for making
the problem worse by adding a plethora of new operators in any language
extension.

					Thomas.



More information about the Numeric-interest mailing list