home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / std / cplus / 1179 < prev    next >
Encoding:
Internet Message Format  |  1992-09-14  |  1.5 KB

  1. Xref: sparky comp.std.c++:1179 comp.lang.c++:13630
  2. Newsgroups: comp.std.c++,comp.lang.c++
  3. Path: sparky!uunet!mcsun!sunic!aun.uninett.no!nuug!nntp.uio.no!hbf
  4. From: hbf@durin.uio.no (Hallvard B Furuseth)
  5. Subject: Re: Exponentiation operator proposal
  6. In-Reply-To: bs@alice.att.com's message of 12 Sep 92 18:30:53 GMT
  7. Message-ID: <HBF.92Sep14205333@durin.uio.no>
  8. Sender: news@ulrik.uio.no (Mr News)
  9. Nntp-Posting-Host: durin.uio.no
  10. Organization: University of Oslo, Norway
  11. References: <23660@alice.att.com>
  12. Date: Mon, 14 Sep 1992 19:53:33 GMT
  13. Lines: 22
  14.  
  15. Sorry, I just cancelled an article where a rather essential part was
  16. deleted (I just intended to move it...)  Here is next attempt -
  17.  
  18. In article <23660@alice.att.com> bs@alice.att.com (Bjarne Stroustrup) writes:
  19.  
  20. > (2) I think we could actually get ** as the exponentiation operator.
  21. > (...)
  22. >       All we need to do is to say that the exponentiation
  23. >       operator ** given a first operand `a' of arithmetic type
  24. >       and a second operand `b' of pointer type (that is, `a**b')
  25. >       mean multiply the first operand with the dereference value
  26. >       of the second operand (that is, `a*(*b)').
  27.  
  28. The few times I use a**b, a and *b are usually class objects.  operator*
  29. could be cross product or a set operation.  b.operator*() may exist too,
  30. but to me that is less important.  To allow both this and Complex
  31. operator**(Complex&,Complex&), I think the rule must be something like
  32. "** is exponentiation unless that is an error".  I do not volunteer to
  33. write the parser though.  A binary operator~ is my favorite.
  34. --
  35.  
  36. Hallvard
  37.