At 04:33 PM 7/22/98 -0400, jeremic@clarkson.edu wrote:
>// Some relevant notes from the Dec. 96 Draft (as pointed out by KAI folks):
>//
>// "A binary operator shall be implemented either by a non-static member
>// function (_class.mfct_) with one parameter or by a non-member function
>// with two parameters. Thus, for any binary operator @, x@y can be
>// interpreted as either x.operator@(y) or operator@(x,y)." [13.5.2]
>//
>// "The order of evaluation of arguments [of a function call] is
>// unspecified." [5.2.2 paragraph 9]
>//
>//
>
>
>The point here being that if you overload operator() it might mess up
>indices if you have same tensor used more than once in a statement. For
>example:
>
>(g_up(i,k)%dX(j,k) || g_up(j,k)%dX(i,k)) might create problem for g_up
>or dX. I'm not sure how your implementation works but it would be
>useful to try it with other compilers. In my case it surfaced when I
>tried KAI C++ (it used to work with SUN CC, all versions of gcc...).
Actually, you've chosen a bad example. ",", "||", and "&&" are sequence
guarantee points; i.e. they guarantee that the left argument is evaluated
before the right argument. If the example replaced "||" with "+" then there
could be a problem, although there shouldn't be if you design your classes
right (IMHO).
Jim
--------------------- blitz-dev list --------------------------------
* To subscribe/unsubscribe: mail to majordomo@oonumerics.org, with
"subscribe blitz-dev" or "unsubscribe blitz-dev" in the body of the message
* Blitz++ web page: http://oonumerics.org/blitz/
This archive was generated by hypermail 2b29 : Wed Feb 20 2002 - 04:30:06 EST