bcc32: strange error when specialising on `std::vector<bool>` - c++

The classic 32-bit Borland/Embarcadero compiler - a.k.a. bcc32 - exhibits a strange failure when a traits class is specialised for std::vector<bool>. In particular, it fails to compile usages of the specialisation because it doesn't find any of its members. With other types - like std::vector<char> - there is no problem at all. Tested with BC++ 5.5.1 (free) and BC++ 7.1 (RX/Seattle).
Is there a workaround for this?
#include <iostream>
#include <typeinfo>
#include <vector>
template<typename T>
struct traits { };
template<> struct traits< std::vector<char> >
{
enum { ENUM = 42 };
static int func () { return ENUM; }
};
template<> struct traits< std::vector<bool> >
{
enum { ENUM = 666 };
static int func () { return ENUM; }
};
///////////////////////////////////////////////////////////////////////////////////////////////////
template<typename T>
void test ()
{
typedef traits<T> TT;
// separate lines to see exactly where the compiler barfs
std::cout << typeid(T).name();
std::cout << " " << TT::ENUM; // E2451 Undefined symbol 'ENUM'
std::cout << " " << TT::func(); // E2451 Undefined symbol 'func'
TT tt;
std::cout << " " << tt.ENUM; // E2316 'ENUM' is not a member of 'traits<std::_Bvector>'
std::cout << " " << tt.func(); // E2316 'func' is not a member of 'traits<std::_Bvector>'
std::cout << "\n";
}
int main ()
{
test< std::vector<char> >();
test< std::vector<bool> >();
return 0;
}
Note: a somewhat hackish workaround that can be useful in certain circumstances is to code the specialisation for vector<bool> into the primary template (which would normally be left undefined); the specialisations on other types can then be done as usual, and the code works as expected even with bcc32.
A runtime assert can verify that the only unspecialised incarnation of the traits template is the one for std::vector<bool>. Templates that use the traits would then invoke the assertion code in a convenient place (which could also be a static function).
template<typename T>
struct traits
{
// specialisation for std::vector<bool> coded here...
enum { ENUM = 666 };
static int func () { return ENUM; }
static void assert_only_vector_bool_not_specialised ()
{
assert(typeid(T) == typeid(std::vector<bool>));
}
};
struct traits_specialisation_base
{
static void assert_only_vector_bool_not_specialised ()
{
}
};
template<> struct traits< std::vector<char> >: traits_specialisation_base
{
enum { ENUM = 42 };
static int func () { return ENUM; }
};
// ...
template<typename T>
struct UsingTraits
{
typedef traits<T> TT;
UsingTraits ()
{
TT::assert_only_vector_bool_not_specialised();
}
};
// ...
UsingTraits< std::vector<char> > erna;
UsingTraits< std::vector<bool> > fred;

There is something fishy in the std:: with std::vector<bool> so you need to use the std:: type instead. just change to:
#include <iostream>
#include <typeinfo>
#include <vector>
//---------------------------------------------------------------------------
template<typename T> struct traits
{
// this is safe constructor/destructor for Borland BDS2006 and later
traits(){};
traits(traits& a){};
~traits(){};
traits* operator = (const traits *a){};
//traits* operator = (const traits &a){}; // use this only if you have dynamic allocation members
};
template<> struct traits< std::vector<char> >
{
enum { ENUM = 42 };
static int func () { return ENUM; }
};
template<> struct traits< std::_Bvector > // here use the std type directly
{
enum { ENUM = 666 };
static int func () { return ENUM; }
};
//---------------------------------------------------------------------------
template<typename T> void test ()
{
typedef traits<T> TT;
// separate lines to see exactly where the compiler barfs
std::cout << typeid(T).name();
std::cout << " " << TT::ENUM; // E2451 Undefined symbol 'ENUM'
std::cout << " " << TT::func(); // E2451 Undefined symbol 'func'
TT tt;
std::cout << " " << tt.ENUM; // E2316 'ENUM' is not a member of 'traits<std::_Bvector>'
std::cout << " " << tt.func(); // E2316 'func' is not a member of 'traits<std::_Bvector>'
std::cout << "\n";
// can ignore this ... it is just output to memo I do not use console
AnsiString s="";
s=s+typeid(T).name() + "\n";
s=s+" " + AnsiString( TT::ENUM ) + "\r\n"; // E2451 Undefined symbol 'ENUM'
s=s+" " + AnsiString( TT::func() ) + "\r\n"; // E2451 Undefined symbol 'func'
s=s+" " + AnsiString( tt.ENUM ) + "\r\n"; // E2316 'ENUM' is not a member of 'traits<std::_Bvector>'
s=s+" " + AnsiString( tt.func() ) + "\r\n"; // E2316 'func' is not a member of 'traits<std::_Bvector>'
Form1->mm_log->Lines->Add(s);
}
//---------------------------------------------------------------------------
// this is your main()
__fastcall TForm1::TForm1(TComponent* Owner):TForm(Owner)
{
test< std::vector<char> >();
test< std::vector<bool> >();
}
//---------------------------------------------------------------------------
I use windows form app so ignore form stuff. The constructors/destructors are not necessary for compilation but you should add them because of the Borland BDS2006 and latter C++ engine bug. For more info see:
BDS 2006 C hidden memory manager conflicts
Too many initializers error for a simple array in bcc32
The code above gives me this output:
std::vector<char,std::allocator<char> >
42
42
42
42
std::vector<std::allocator<bool> >
666
666
666
666

Related

Collect instantiated template types at compile time

Consider this snippet:
struct A {
template <typename T> void bar(const T &) {
/*
I would like to write something like:
if constexpr(type T already processed/T is already present in typelist)
...do something fancy
else if constexpr(type T not processed/T is not present in typelist)
*/
}
};
struct Msg1 {};
struct Msg2 {};
int main() {
A a;
a.bar(Msg1{});
a.bar(Msg1{});
}
Demo
Is it possible to see at compile time for which types the method bar was already instantiated?
Ideally, there would be some kind of growing typelist, where one can check at compile time for which types bar is already instantiated.
No. It is not possible to do so at compile time. However, it would be possible to do the following at runtime:
#include <typeindex>
#include <type_traits>
#include <unordered_set>
struct A {
private:
std::unordered_set<std::type_index> already_processed_ts;
public:
template<typename T>
void bar(const T&){
if(already_processed_ts.find(typeid(T)) != already_processed_ts.end())
std::cout << "Already processed " << typeid(T).name() << std::endl;
else{
already_processed_ts.insert(typeid(T));
std::cout << "Processing " << typeid(T).name() << "... \n";
}
}
}
struct Msg{};
int main()
{
f(Msg{}); // Prints "Processing 3Msg..." (at least on my compiler)
f(Msg{}); // Prints "Already processed 3Msg"
return 0;
}

about the sizeof winrt Demo object

I'm curious about the size of a very simple Demo object , so , I'm writing the following code
#include <windows.h>
#include "winrt/base.h"
#include <iostream>
#pragma comment(lib, "windowsapp")
/*
cl /nologo /await /std:c++latest /wd4002 /EHsc base_so.cpp
*/
using namespace std;
using namespace winrt;
using namespace winrt::impl;
struct IDemo;
template <typename D>
struct consume_IDemo
{
void hello();
};
template <> struct consume<IDemo> { template <typename D> using type = consume_IDemo<D>; };
template <typename D> void consume_IDemo<D>::hello()
{
WINRT_SHIM(D)->hello();
}
struct WINRT_EBO __declspec(uuid("3A44B7CC-9CB6-4512-8CAD-6400E662D865"))
IDemo : Windows::Foundation::IInspectable, consume_t<IDemo>
{
IDemo(std::nullptr_t = nullptr) noexcept {};
};
template <> struct abi<IDemo>
{
struct type : IInspectable
{
virtual HRESULT hello() = 0;
};
};
template <typename D>
struct produce<D,IDemo> : produce_base<D,IDemo>
{
HRESULT hello() override
{
shim().hello();
return S_OK;
}
};
struct Demo : implements<Demo,IDemo>
{
Demo()
{
cout << "sizeof Demo 0x" << hex << sizeof(*this) << dec << endl;
cout << "sizeof m_references 0x" << hex << sizeof(std::atomic<std::conditional_t<1, uintptr_t, uint32_t>>) << dec << endl;
cout << "is_composing " << is_composing << endl;
cout << "outer " << outer() << endl;
}
HRESULT hello()
{
cout << __FUNCTION__ << endl;
return S_OK;
}
};
int main()
{
Demo d;
}
and the output is
sizeof Demo 0x18
sizeof m_references 0x8
is_composing 0
outer 0000000000000000
I think the sizeof Demo should be 0x10 (64 machine) : sizeof(m_references)+sizeof(produce<Demo,IDemo>) , so , what is the extra 8 bytes ? many thanks!
It's either padding or v-tables. Maybe both...
The compiler is likely to insert a v-table pointer for each base class that has at least one virtual method declared. (And as an aside, when you do a C-cast, static_cast, or dynamic_cast from the concrete class to the non-first base class, the compiler will change the pointer value to that of the base-class or its v-table.)
Let's break it down.
Demo inherits from implements<Demo,IDemo>
implements is defined as follows:
struct implements : impl::producers<D, I...>, impl::base_implements<D, I...>::type
{
Now we're getting into WinRT noise. But it does seem to suggest multiple-inheritance. But it's just easier to break this out it the debugger.... There you go. The first vtable is for IUnknown. The other is something related to IInspectable.
So it makes sense. Each v-table is an 8 byte pointer. And the m_references is also 8 bytes. 8+8+8 = 24 = 0x18

How do I use a numeric_cast policy?

So I have my own policy for uint64_t to uint32_t numeric cast
struct MyOverflowHandlerPolicy
{
void operator() ( boost::numeric::range_check_result ) {
std::cout << "MyOverflowHandlerPolicy called" << std::endl;
throw boost::numeric::positive_overflow();
};
} ;
How do I get it to be used by boost::numeric_cast?
In order to use numeric_cast, numeric_cast_traits specialization should defined on each type conversions. These specializations are already defined with default values for the built-in numeric types. It is possible to disable the generation of specializations for built-in types by defining BOOST_NUMERIC_CONVERSION_RELAX_BUILT_IN_CAST_TRAITS (details).
Here is a small running sample.
#include <iostream>
#include <stdexcept>
#define BOOST_NUMERIC_CONVERSION_RELAX_BUILT_IN_CAST_TRAITS
#include <boost/numeric/conversion/cast.hpp>
using namespace std;
struct YourOverflowHandlerPolicy
{
void operator() ( boost::numeric::range_check_result r ) {
cout << "YourOverflowHandlerPolicy called" << endl;
if (r != boost::numeric::cInRange) {
throw logic_error("Not in range!");
}
};
};
namespace boost { namespace numeric {
template <>
struct numeric_cast_traits<uint32_t, uint64_t>
{
typedef YourOverflowHandlerPolicy overflow_policy;
typedef UseInternalRangeChecker range_checking_policy;
typedef Trunc<uint64_t> rounding_policy;
};
template <>
struct numeric_cast_traits<uint64_t, uint32_t>
{
typedef YourOverflowHandlerPolicy overflow_policy;
typedef UseInternalRangeChecker range_checking_policy;
typedef Trunc<uint32_t> rounding_policy;
};
}} //namespace boost::numeric;
int main()
{
try {
cout << boost::numeric_cast<uint32_t>((uint64_t)1) << endl; // OK
cout << boost::numeric_cast<uint32_t>((uint64_t)1<<31) << endl; // OK
cout << boost::numeric_cast<uint32_t>((uint64_t)1<<32) << endl; // Exception
} catch (...) {
cout << "exception" << endl;
}
return 0;
}
Output:
YourOverflowHandlerPolicy called
1
YourOverflowHandlerPolicy called
2147483648
YourOverflowHandlerPolicy called
exception
Note: I have boost release 1.55.0, I don't know the minimum release level to get it compiled but it isn't compiled with 1.46.0. So, please check your boost release and update if necessary.

Separate Compilation of template with non-type argument

I'm trying to do separate compilation of my non-type argument template, but I am facing a few problems. My application has a number of opcodes, and each opcode is associated with certain data and functions, many of which are similar and could be defined in the primary template, then the differences can be put into specialized templates.
So here is the original in-line code:
(header)
#include <iostream>
template<int opcode>
class BAR
{
public:
BAR(){};
void foo()
{
std::cout << "BAR<int>::foo()" << std::endl;
}
};
// specialize 1 and 2, otherwise we go with the
// primary definition.
template <>
void BAR<1>::foo()
{
std::cout << "BAR<1>::foo()" << std::endl;
}
template <>
void BAR<2>::foo()
{
std::cout << "BAR<2>::foo()" << std::endl;
}
I have a simple 'main':
int main(int argc, char* argv[])
{
BAR<1> bar_1;
BAR<2> bar_2;
BAR<3> bar_3;
bar_1.foo();
bar_2.foo();
bar_3.foo();
return 0;
}
I managed to put the specializations for '1' and '2' into a cpp file and this is
what I have:
(header)
#include <iostream>
template<int opcode>
class BAR
{
public:
BAR(){};
void foo()
{
std::cout << "BAR<int>::foo()" << std::endl;
}
};
// specialize 1 and 2, otherwise we go with the
// primary definition.
template<> void BAR<1>::foo() ;
template<> void BAR<2>::foo() ;
(cpp)
#include "Foo.h"
#include <iostream>
template<> void BAR<1>::foo()
{
std::cout << "BAR<1>::foo()" << std::endl;
}
template<> void BAR<2>::foo()
{
std::cout << "BAR<2>::foo()" << std::endl;
}
void x()
{
BAR<1> b1;
BAR<2> b2;
b1.foo();
b2.foo();
}
I not real crazy about the x() function, but without this I get unresolved symbols for BAR<1>::foo() & BAR<2>::foo(), if there's a better way, I'd be interested ( MSVC 13 compiler).
Ok so far so good. I really want to put the primary definition of the function foo() into the CPP, but I can't seem to get the syntax right:
template<> void BAR<int>::foo()
{
std::cout << "BAR<int>::foo()" << std::endl;
}
this is not allowed by the compiler, and rightly so I guess, is not
a valid non-type value. So what is the magic words to use to do this?
Many thanks in advance for any help.
dave.

template functions with shared private data

I'm looking for 'best-practice' in the following situation:
In general, there are three common ways to share private data between two (or more) non-member functions with differential advantages and disadvantages:
// Example 1: using 'static' class
// HPP
namespace foo {
class bar
{
private:
static const char* const s_private;
bar();
public:
static void s_method0();
static void s_method1();
}; /* class bar */
} /* namespace foo */
// CPP
namespace foo {
const char* const bar::s_private = "why do I need to be visible in HPP?";
void bar::s_method0() { std::cout << "s_method0 said: " << s_private << std::endl; }
void bar::s_method1() { std::cout << "s_method1 said: " << s_private << std::endl; }
} /* namespace foo */
// Example 2: using unnamed-namespace
// HPP
namespace foo {
void bar0();
void bar1();
} /* namespace foo */
// CPP
namespace foo {
namespace {
const char* const g_anonymous = "why do I need external linkage?";
} /* unnamed-namespace */
void bar0() { std::cout << "bar0 said: " << g_anonymous << std::endl; }
void bar1() { std::cout << "bar1 said: " << g_anonymous << std::endl; }
} /* namespace foo */
// Example 3: using static keyword in namespace-scope
// HPP
namespace foo {
void bar0();
void bar1();
} /* namespace foo */
// CPP
namespace foo {
static const char* const g_internal = "nobody outside this file can see me and I don't have external linkage";
void bar0() { std::cout << "bar0 said: " << g_internal << std::endl; }
void bar1() { std::cout << "bar1 said: " << g_internal << std::endl; }
} /* namespace foo */
I prefer 'Example 3' because it's as close to the intention as it could be.
But now I'm running in some problem's using templated functions. 'Example 1' seems to be the only way to solve this:
// HPP
namespace foo {
class bar
{
private:
static const char* const s_private;
bar();
public:
template<typename T> static void s_method0() { std::cout << "s_method0 said: " << s_private << std::endl; }
template<typename T> static void s_method1() { std::cout << "s_method1 said: " << s_private << std::endl; }
}; /* class bar */
} /* namespace foo */
// CPP
namespace foo {
const char* const bar::s_private = "why do I need to be visible in HPP?";
} /* namespace foo */
That's unsatisfying. Especialy because there are other (in this case methods) non-member function which should be in the same (in this case class-) scope, which don't need to access this private data.
Does anybody know an elegant solution?
Thanks for any help.
Best regards.
This is, somewhat unfortunately, an issue that springs quite often with template.
But may I suggest that you are over-engineering here ?
The truth is, whether you look at Loki code (by Andrei Alexandrescu) or Boost code (infamous David Abrahams notably), no-one really bothered to provide a better privacy.
Rather, they simply relied on convention and used a Private namespace (Loki) or a detail namespace (Boost, with sometimes a longer and more descriptive name to prevent clashes).
It's annoying, but there is not much you can do in practice.... though I actually have a solution for your specific problem ;)
// Evil solution!
#ifdef MY_SUPER_MACRO
# error "MY_SUPER_MACRO is already defined!"
#endif
#define MY_SUPER_MACRO "Some string"
template <typename T> void foo() { std::cout << "foo - " MY_SUPER_MACRO "\n"; }
template <typename T> void bar() { std::cout << "bar - " MY_SUPER_MACRO "\n"; }
#undef MY_SUPER_MACRO
And hop, I achieved locality in a header with an evil macro :)
If I understand correctly, your complaint/concern is that unlike with templates, with non-templates, one can define the function bodies inside the CPP, rather than the header, in which case they can access non-class statics, which are "invisible" to the outside world, including member functions defined in the header. This is all true.
However, remember that there's nothing stopping one defining other member functions in the CPP as well, in which case, they'd be equally able to access the static data. So really, the situation is no different. Your complaint is based on a false dichotomy.
If you genuinely want to prevent anything but s_method0<T>() and s_method1<T>() accessing s_private, then you must put them all in a dedicated class. It's as simple as that. This would be the case even for non-templates.
I had played around with the different techniques. My idea, using the unnamed namespace in the header file, was to 'mark' the 'shared'-classes as 'header-file-only'. Sure, due to the fact they aren't containing public members you cannot make nasty things anyway with it. But I thought it would be more close to the intention.
But I was wrong! After thinking about this I'm in shame. It's so logically simple. This example is showing what's the problem with it (entire code for clearness):
// header0.hpp
#ifndef HPP_HEADER0_INCLUDED
#define HPP_HEADER0_INCLUDED
#include <iostream>
#include <string>
namespace ns {
template<typename T> void header0_func0();
template<typename T> void header0_func1();
namespace {
class header0
{
template<typename> friend void ns::header0_func0();
template<typename> friend void ns::header0_func1();
static std::string s_private;
}; /* class header0 */
} /* unnamed */
template<typename T> void header0_func0() { std::cout << "header0_func0: " << header0::s_private << std::endl; }
template<typename T> void header0_func1() { std::cout << "header0_func1: " << header0::s_private << std::endl; }
} /* namespace ns */
#endif /* HPP_HEADER0_INCLUDED */
// header1.hpp
#ifndef HPP_HEADER1_INCLUDED
#define HPP_HEADER1_INCLUDED
#include <iostream>
#include <string>
namespace ns {
template<typename T> void header1_func0();
template<typename T> void header1_func1();
namespace {
class header1
{
template<typename> friend void ns::header1_func0();
template<typename> friend void ns::header1_func1();
static std::string s_private;
}; /* class header1 */
} /* unnamed */
template<typename T> void header1_func0() { std::cout << "header1_func0: " << header1::s_private << std::endl; }
template<typename T> void header1_func1() { std::cout << "header1_func0: " << header1::s_private << std::endl; }
} /* namespace ns */
#endif /* HPP_HEADER1_INCLUDED */
// source.cpp
#include "header0.hpp"
#include "header1.hpp"
std::string ns::header0::s_private = "header0 private data definition by source.cpp",
ns::header1::s_private = "header1 private data definition by source.cpp";
namespace {
// hide private class
class source
{
source();
~source();
static source s_instance;
};
source::source() {
std::cout << "source.cpp:\n";
ns::header0_func0<int>();
ns::header0_func1<int>();
ns::header1_func0<int>();
ns::header1_func1<int>();
std::cout << '\n';
}
source::~source() { }
source source::s_instance;
} /* unnamed */
By now everything seems to be OK. But what happen's if we try to use our headers in other translation units? Let's take a look:
// main.cpp
#include "header0.hpp"
#include "header1.hpp"
int main()
{
std::cout << "main.cpp:\n";
ns::header0_func0<int>();
ns::header0_func1<int>();
ns::header1_func0<int>();
ns::header1_func1<int>();
std::cout << '\n';
return 0;
}
What happens is, that we are ending with 2 unresolved externals. So, is the linker just an idiot? No, he is not. Thinking about what are unnamed namespace used for, we know what's going on. An unnamed namespace has an unique identifier in each translation unit. Thus, in our main.cpp, the linker doesn't know the definition of our private data in source.cpp.
So, what happens if we define this private data in main.cpp - just to bring matters to a head - ?
// main.cpp
#include "header0.hpp"
#include "header1.hpp"
std::string ns::header0::s_private = "header0 private data definition by main.cpp",
ns::header1::s_private = "header1 private data definition by main.cpp";
int main()
{
std::cout << "main.cpp:\n";
ns::header0_func0<int>();
ns::header0_func1<int>();
ns::header1_func0<int>();
ns::header1_func1<int>();
std::cout << '\n';
return 0;
}
Now, everything is compiling and getting linked 'correctly' - or rather, it seems so.
This is the console output of that program:
source.cpp:
header0_func0: header0 private data definition by source.cpp
header0_func1: header0 private data definition by source.cpp
header1_func0: header1 private data definition by source.cpp
header1_func0: header1 private data definition by source.cpp
main.cpp:
header0_func0: header0 private data definition by source.cpp
header0_func1: header0 private data definition by source.cpp
header1_func0: header1 private data definition by source.cpp
header1_func0: header1 private data definition by source.cpp
That means: If undefined behavior is what you are looking for, here you are.
In other words: Based on the explanation above: Don't use unnamed namespace in header files to encapsulate private shared data.
And the last question is, "what's the solution?"
If you don't want to use 'static' (utility) classes, you should prefer my first posted solution (only changed code):
// header0.hpp
// ...
namespace ns {
// ...
namespace detail {
class header0 { /*...*/ };
} /* namespace detail */
template<typename T> void header0_func0() { std::cout << "header0_func0: " << detail::header0::s_private << std::endl; }
template<typename T> void header0_func1() { std::cout << "header0_func1: " << detail::header0::s_private << std::endl; }
} /* namespace ns */
// ...
// header1.hpp
// ...
namespace ns {
// ...
namespace detail {
class header1 { /*...*/ };
} /* namespace detail */
template<typename T> void header0_func0() { std::cout << "header0_func0: " << detail::header1::s_private << std::endl; }
template<typename T> void header0_func1() { std::cout << "header0_func1: " << detail::header1::s_private << std::endl; }
} /* namespace ns */
// ...
// source.cpp
// ...
std::string ns::detail::header0::s_private = "header0 private data definition by source.cpp",
ns::detail::header1::s_private = "header1 private data definition by source.cpp";
// ...
I'm looking forward to any comment. Best regards.
What about that?
namespace foo {
namespace detail {
class shared
{
template<typename> friend void bar0();
template<typename> friend void bar1();
static const char* const m_private;
}; /* class shared */
} /* namespace detail */
template<typename T> void bar0() { std::cout << "bar0 said: " << detail::shared::m_private << std::endl; }
template<typename T> void bar1() { std::cout << "bar1 said: " << detail::shared::m_private << std::endl; }
} /* namespace foo */
EDIT 2:
OBSOLETE ANSWER. THIS CODE ISN'T WORKING! POSTED AN EXPLANATION BELOW.
EDIT:
In 'real code' I would replace namespace detail by an unnamed namespace. This would bring up the possibility to add other shared resources in different header files using the same name-scope:
namespace foo {
template<typename T> void bar0();
template<typename T> void bar1();
template<typename T> void bar2();
template<typename T> void bar3();
namespace {
class shared0
{
template<typename> friend void foo::bar0();
template<typename> friend void foo::bar1();
static const char* const m_private0;
}; /* class shared0 */
class shared1
{
template<typename> friend void foo::bar2();
template<typename> friend void foo::bar3();
static const char* const m_private1;
}; /* class shared1 */
} /* unnamed */
template<typename T> void bar0() { std::cout << "bar0 said: " << shared0::m_private0 << std::endl; }
template<typename T> void bar1() { std::cout << "bar1 said: " << shared0::m_private0 << std::endl; }
template<typename T> void bar2() { std::cout << "bar0 said: " << shared1::m_private1 << std::endl; }
template<typename T> void bar3() { std::cout << "bar1 said: " << shared1::m_private1 << std::endl; }
} /* namespace foo */