Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: .  (Read 6023 times)

0 Members and 1 Guest are viewing this topic.

Helios101

  • Newbie
  • *
  • Posts: 15
    • View Profile
.
« on: January 04, 2014, 01:13:59 am »
.
« Last Edit: May 03, 2018, 05:29:04 am by Helios101 »

nwp

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Understanding The syntax of SFML.
« Reply #1 on: January 04, 2014, 01:39:46 am »
It is a namespace like std. Use
using namespace sf;
if it bothers you.

OniLinkPlus

  • Hero Member
  • *****
  • Posts: 500
    • View Profile
Re: Understanding The syntax of SFML.
« Reply #2 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.
I use the latest build of SFML2

Omega

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: Understanding The syntax of SFML.
« Reply #3 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.

Raincode

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: Understanding The syntax of SFML.
« Reply #4 on: January 04, 2014, 06:18:22 pm »
That has nothing to do with SFML, the syntax comes from the programming language, C++.

Jebbs

  • Sr. Member
  • ****
  • Posts: 358
  • DSFML Developer
    • View Profile
    • Email
Re: Understanding The syntax of SFML.
« Reply #5 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.
DSFML - SFML for the D Programming Language.