SFML community forums

General => General discussions => Topic started by: Helios101 on January 04, 2014, 01:13:59 am

Title: .
Post by: Helios101 on January 04, 2014, 01:13:59 am
.
Title: Re: Understanding The syntax of SFML.
Post by: nwp on January 04, 2014, 01:39:46 am
It is a namespace like std. Use
using namespace sf;
if it bothers you.
Title: Re: Understanding The syntax of SFML.
Post by: OniLinkPlus on January 04, 2014, 02:08:42 am
It is a namespace like std. Use
using namespace sf;
if it bothers you.

Never use "using namespace" for any namespace. It is widely considered bad practice due to causing namespace collisions and the fact that the namespace clarifies where a function/class/etc is coming from, making code a bit easier to understand and making it easier to find the proper documentation for a function/class/etc.
Title: Re: Understanding The syntax of SFML.
Post by: Omega on January 04, 2014, 04:22:50 am
It is a namespace like std. Use
using namespace sf;
if it bothers you.

Never use "using namespace" for any namespace. It is widely considered bad practice due to causing namespace collisions and the fact that the namespace clarifies where a function/class/etc is coming from, making code a bit easier to understand and making it easier to find the proper documentation for a function/class/etc.

Don't say never. You can use "using namespace" in a scoped block which can be advantageous. What you really don't want to do is use a namespace outside of a scoped block, such as in the global space of a header file. You can read here (http://stackoverflow.com/questions/223021/whats-the-scope-of-the-using-declaration-in-c) for more ideas.
Title: Re: Understanding The syntax of SFML.
Post by: Raincode on January 04, 2014, 06:18:22 pm
That has nothing to do with SFML, the syntax comes from the programming language, C++.
Title: Re: Understanding The syntax of SFML.
Post by: Jebbs on January 05, 2014, 10:30:04 pm
It is a namespace like std. Use
using namespace sf;
if it bothers you.

Never use "using namespace" for any namespace. It is widely considered bad practice due to causing namespace collisions and the fact that the namespace clarifies where a function/class/etc is coming from, making code a bit easier to understand and making it easier to find the proper documentation for a function/class/etc.

Don't say never. You can use "using namespace" in a scoped block which can be advantageous. What you really don't want to do is use a namespace outside of a scoped block, such as in the global space of a header file. You can read here (http://stackoverflow.com/questions/223021/whats-the-scope-of-the-using-declaration-in-c) for more ideas.

Wow, that's pretty sweet! I guess I never thought to do that, haha.