[Mesa-dev] [PATCH 1/3] nv50/ir: support different unordered_set implementations

Ilia Mirkin imirkin at alum.mit.edu
Fri Jun 19 10:28:21 PDT 2015


On Fri, Jun 19, 2015 at 1:19 PM, Chih-Wei Huang <cwhuang at android-x86.org> wrote:
> 2015-06-20 1:01 GMT+08:00 Ilia Mirkin <imirkin at alum.mit.edu>:
>> Wouldn't it be simpler to just have
>>
>> codegen/unordered_set.h
>>
>> which in turn has all the odd logic? I'm definitely a tad unhappy
>> about adding "using" in a header, but if the using goes inside the
>> nv50_ir namespace, I'm less weirded out by it. And then effectively
>> all 3 become nv50_ir::unordered_set, instead of the current situation
>> with 2 ::unordered_set and 1 nv50_ir::unordered_set.
>
> Well, I think the style is suggested by Francisco.
>
> Let me make sure.
> Do you hope me to move all #if ... #elif ... #else
> logic into codegen/unordered_set.h,
> and keep the "using" in nv50_ir namespace only?

That would be my preference. I haven't used C++ seriously in a while,
but I definitely remember that having a using in a global namespace is
a problem waiting to happen. So the codegen/unordered_set.h header
would go something like

#if foo
#include
#else if
#include
#endif

namespace nv50_ir {
#if foo
using a
#else if bar
using b
#else
crazy-class
#endif
}

Does that make sense to you?


More information about the mesa-dev mailing list