// ---------------------------------------------------------------------- // // nmspace.cc - Test for compliance with 'namespace' and allied keywords. // // History: // 21-Jun-1999 WEB Initial draft // 15-Feb-2000 WEB Update to correspond to revised USING macro // 25-Apr-2001 WEB s//"ISOcxx\/ISOcxxSyntax.hh"/ // // ---------------------------------------------------------------------- #include "ISOcxx/ISOcxxSyntax.hh" // ---------------------------------------------------------------------- // Define part 1 of a namespace, test1: // ---------------------------------------------------------------------- BEGIN_NAMESPACE(test1) int f(); int g(); END_NAMESPACE(test1) // ---------------------------------------------------------------------- // Define a function in the global namespace: // ---------------------------------------------------------------------- int g() { return 0; } // ---------------------------------------------------------------------- // Define another namespace, test2: // ---------------------------------------------------------------------- BEGIN_NAMESPACE(test2) int g() { return 2; } int h() { return 0; } END_NAMESPACE(test2) // ---------------------------------------------------------------------- // Define part 2 of namespace test1: // ---------------------------------------------------------------------- BEGIN_NAMESPACE(test1) int f() { return ::g(); } int g() { return 1; } END_NAMESPACE(test1) // ---------------------------------------------------------------------- // Begin execution here: // ---------------------------------------------------------------------- int main() { USING(test1::f) USING_NAMESPACE(test2) return f() + ::g() + h(); } // main()