SFML community forums
General => SFML website => Topic started by: Kyle on September 29, 2009, 06:34:08 pm
-
Why is it in functions sf:: is getting used, doesn't using namespace sf; eliminate the need for this?
-
doesn't using namespace sf; eliminate the need for this?
I have a better idea. Not using a namespace at all in SFML eliminates the need for "using namespace sf".
Seriously, I leave the choice to the user. And I can't put "using namespace sf" in every piece of code of the tutorials. So at least by prefixing every class with sf:: I'me sure that I won't get hundreds of stupid posts such as "the compiler doesn't recognizes my class??!!!!" on the forum ;)
PS: I personnally never use "using namespace xxx", and I think that you shouldn't consider it obvious to do so
-
Whats the point of namespaces if you use the "using namespace" command? There is no point that I can think of.
-
PS: I personnally never use "using namespace xxx", and I think that you shouldn't consider it obvious to do so
Me neither (except for some really rare cases inside a local function, for example to access an enum which is surrounded by a namespace). And I don't think avoiding this is bad practice. Most important, never write the using directive into headers because the whole namespace is emptied out in all including files.
One can also contribute reducing the global namespace pollution by not using using namespace :D
-
I find it better to use "sf::" that gives personnality to SFML, besides I'm not for namespace at all, because you can do mistake if there's a same name in two differents librairies, for exemple sf::String and std::string. I personnaly use the namespace only for STD, and using "sf::" allow you to directly recognize that you are using a SFML function. :D
-
besides I'm not for namespace at all, because you can do mistake if there's a same name in two differents librairies, for exemple sf::String and std::string
That's exactly what namespaces are for ;)
-
Sorry i was meaning that I'm not for writting "using namespace ..." , just a misunderstanding :)