freepooma-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pooma-dev] POOMA Namespace Pollution


From: Jeffrey D. Oldham
Subject: Re: [pooma-dev] POOMA Namespace Pollution
Date: Wed, 26 Nov 2003 10:42:24 -0800
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624

Richard Guenther wrote:
On Wed, 26 Nov 2003, Hendrik Belitz wrote:

Am Mittwoch, 26. November 2003 15:07 schrieben Sie:

You can also mark the colliding names inside the sources with namespace
Pooma. But I really suspect internal Pooma is not namespace clean.

It doesn't seem to be. Putting the POOMA headers into a namespace won't solve
the problem (this seem to lead to a double inclusion of some STL headers,
resulting in a pretty large bunch of errors). Not putting POOMA into an
namespace shows that most of the internal POOMA structures are not in the
POOMA namespace at all (Resulting in namespace pollution).


Yes, in fact, all over the POOMA source there are commented out namespace
Pooma guards, so I think there were compiler problems some time ago. I
already put some global functions back into Pooma namespace locally, so
maybe there needs to be a point in the future we re-enable all the Pooma
namespace.

Maybe Jeffrey has some suggestions on this, as it breaks backward
compatibility.

This might be a good time to add namespace support for POOMA. I know of two issues:

1) Backwards compatibility: We might be able to maintain backwards compatibility by supporting optional namespaces where the default option is no namespaces. I attach a file with a possible approach.

2) Adding namespaces to PETE, the loop fusion mechanism, may be non-trivial.

--
Jeffrey D. Oldham
address@hidden
#ifdef USE_NS /* If a namespace is desired, use these definitions:  */
#define NS_BEGIN namespace pooma {
#define NS_NAME pooma::
#define NS_END }

#else /* If a namespace is not desired, use these definitions: */
#define NS_BEGIN 
#define NS_NAME 
#define NS_END 
#endif // USE_NS

NS_BEGIN
struct Foo {
  void foo ();
};
NS_END

void NS_NAME Foo::foo () { /* do nothing */ }

int main ()
{
  /* Most user code will hopefully be written without using the macros
     since the user will know if namespaces are supported or not.
     Despite that, we show one way to support both types of code.  */
#if USE_NS
#define POOMA_NS pooma::
#else
#define POOMA_NS
#endif

  POOMA_NS Foo f;
  f.foo ();
}

reply via email to

[Prev in Thread] Current Thread [Next in Thread]