Just a note: you should NEVER have a 'using namespace' declaration at
the top level of a normal header file.  This forces all the names in
that namespace into the global namespace of any source file including
that header file, which basically completely defeats the point of
namespaces.

It is OK to use using declarations at the top level of a source (.cc)
file since the effect is entirely local to that .cc file. It's also OK
to use them in _impl.hh files, since for practical purposes these are
source (not header) files despite their extension.

I just ran into a case where Ruby doesn't compile with MIPS because
arch/mips/isa_traits.hh has "using namespace MipsISA;" at the end of
it, so all of the MipsISA registers are globals, and there's a Debug
in the MiscRegTags enum that conflicts with a Ruby class name.

I just added a note to this effect at
http://m5sim.org/wiki/index.php/Coding_Style#File_structure_and_modularity.

Fortunately the fixes weren't too bad; I'll be pushing them soon.

Steve
_______________________________________________
m5-dev mailing list
m5-dev@m5sim.org
http://m5sim.org/mailman/listinfo/m5-dev

Reply via email to