Erratum: is "using namespace std" good style?

Erratum: is "using namespace std" good style?

Post by Steven T. » Fri, 28 May 2004 06:27:45



Sorry, I neglected to add one important element. Add the two last lines
after namespace assign, as indicated:

namespace assign {
int acalc(int x, int y)
{
return x - y;
}

float acalc(float x, float y)
{
return y!=0? x/y: 0;
}
}

using namespace assign_f;
using namespace assign_i;

--
STH
Hatton's Law: "There is only One inviolable Law"
KDevelop: http://www.yqcomputer.com/ SuSE: http://www.yqcomputer.com/
Mozilla: http://www.yqcomputer.com/
 
 
 

1. Is 'using namespace std;' valid without 'namespace std {};' first?

2. Using classes as namespaces: good style?

Is it considered good style to use classes as namespaces in PHP (that
is, PHP 4.3.1)?

Like:

class MyClass
{
function test() { echo 'MyClass::test'; }
}

class YourClass
{
function test() { echo 'YourClass::test'; }
}

MyClass::test();
YourClass::test();


Reason is: I've got several functions that do almost the same thing, yet
giving them all different names may result in long, ugly, and
error-prone names like getArticleUpperRowUsingHeading.

Using proper parameters like getArticleRow($side, $using_heading) is
also out of question, because I wish to use the functions as variable
functions (call_user_func). The custom arguments (they'd all differ from
function to function) logically wouldn't even be known by the caller.

Putting the functions into classes looks like an acceptable alternative
to me, though doing so may actually be very stupid... I don't know which
way to go :)


--
Christian Hackl

3. Using C++ namespaces in C# namespace style

4. Errata, Errata, who's got the Errata

5. Why there is just one namespace 'std' in the std library?

6. BCB2006: memset, std namespace, std header idempotence, bug?

7. Convert std::string to std::wstring using std::ctype widen()

8. Q: Convert std::string to std::wstring using std::ctype widen()

9. using namespace std?

10. why "using namespace std; " is not working?

11. Question about using namespace std

12. ctype.h & using namespace std

13. using namespace std

14. does not compile with "using namespace std"