[pooma-dev] std:: Policy for PoomaOps.in?

James Crotinger JimC at proximation.com
Tue Jul 10 19:31:08 UTC 2001


I don't have anything formal. Most people have done Koenig lookup of
operators for some time since there is no other way to name the operator
(and still use it as an operator). What didn't work correctly with several
compilers the last time I tested (back when I was looking at putting
namespace support into PETE) was function lookup. For example:

#include <iostream>
using std::cout;
using std::endl;
 
namespace MySpace {
 
  template <class T>
  class A 
  {
  public: 
    A(const T &t) : t_m(t) { }
    T t_m;
  };
 
  template <class T>
  T sum(const T &t1, const T &t2)
  {
    return T(t1.t_m + t2.t_m);
  }
 
  int sumInt(int t1, int t2)
  {
    return t1 + t2;
  }
}
 
int main()
{
  MySpace::A<int> a(1);
  MySpace::A<int> b(2);
 
  MySpace::A<int> c = sum(a,b);
 
  cout << "A(1) + A(2) = " << c.t_m << endl;
 
  cout << "1 + 2       = " << MySpace::sumInt(1,2) << endl;
 
  return 0;
}

The line of note is "c = sum(a,b)". If Koenig lookup is implemented, the
function "sum" does not need to be qualified with MySpace::, unlike the call
to sumInt, which does need to be qualified. 
 
This appears to work with GCC 2.95, but I seem to recall that there are
problems with its implementation. Marks says 3.00 works. It does not work
with VC++6.0 or, surprisingly, with Intel VTune 5.0. The latter, along with
SGI's CC, may be the main showstoppers. 
 
    Jim
 
 
 -----Original Message-----
From: Julian C. Cummings [mailto:cummings at linkline.com]
Sent: Monday, July 09, 2001 5:17 PM
To: James Crotinger
Subject: RE: [pooma-dev] std:: Policy for PoomaOps.in?



Jim,
 
Do you have any little example codes that test the 
Koenig lookup functionality?  I'd be happy to run them
through Intel VTune and see what happens.
 
I should look at what Blitz does regarding this issue.
I know that Blitz Arrays and other objects are in a
blitz namespace, but of course expression templates
are handled differently than in Pooma.
 
Julian C.
 

-----Original Message-----
From: James Crotinger [mailto:JimC at proximation.com]
Sent: Monday, July 09, 2001 1:09 PM
To: 'Gabriel Dos Reis'; Mark Mitchell
Cc: James Crotinger; 'John Hall'; pooma-dev at pooma.codesourcery.com
Subject: RE: [pooma-dev] std:: Policy for PoomaOps.in?





> -----Original Message----- 
> 
> Hi Mark, 
> 
> I guess you meant GCC-3.0. 
> 
> I don't know which compilers are used for POOMA but I used to have 
> reports that VC++-6.0 has serious problems with Koenig lookup.  I 
> don't know the case for other compilers. 

VC++6.0 isn't a target platform - it doesn't even support partial
specialization. I'm not sure what the situation is with the Intel VTune
compiler, though (wrt Koenig lookup). 

  Jim 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/pooma-dev/attachments/20010710/36a009ca/attachment.html>


More information about the pooma-dev mailing list