Hi Dave,> We ran into a similar problem in our custom code here. To work around > it I modified Debug.h like this: > > #ifdef NDEBUG > static llvm::OStream NullStream(0); > #define DOUT llvm::NullStream > #else > #define DOUT llvm::getErrorOutputStream(DEBUG_TYPE) > #endif >I thought about doing this, but there's the potential for naming conflicts that won't be caught until a release build is done. :-( I wonder, though. Would it make sense to put the stream decls in their own namespace (say "namespace stream")? That way we could prevent naming conflicts and also this bad "gotcha"... -bw
On Tuesday 25 September 2007 13:40, Bill Wendling wrote:> I thought about doing this, but there's the potential for naming > conflicts that won't be caught until a release build is done. :-( II considered this and figured that it was extremely unlikely in our code. Certainly it's not a bullet-proof solution.> wonder, though. Would it make sense to put the stream decls in their > own namespace (say "namespace stream")? That way we could prevent > naming conflicts and also this bad "gotcha"...The problem is that you can't use "cerr" so conveniently unless you put a "using stream::cerr" in Streams.h. Maybe that's ok, though. I'd be willing to go this route. -Dave
On 9/25/07, David Greene <dag at cray.com> wrote:> On Tuesday 25 September 2007 13:40, Bill Wendling wrote: > > > I thought about doing this, but there's the potential for naming > > conflicts that won't be caught until a release build is done. :-( I > > I considered this and figured that it was extremely unlikely in our code. > Certainly it's not a bullet-proof solution. >I'd think it unlikely as well. :-)> > wonder, though. Would it make sense to put the stream decls in their > > own namespace (say "namespace stream")? That way we could prevent > > naming conflicts and also this bad "gotcha"... > > The problem is that you can't use "cerr" so conveniently unless you put > a "using stream::cerr" in Streams.h. Maybe that's ok, though. I'd be willing > to go this route. >Yeah. It's a bit more verbose, but could be worth it. I'll see what I can do. -bw