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

Author Topic: using namespace  (Read 1804 times)

0 Members and 1 Guest are viewing this topic.

dreta

  • Newbie
  • *
  • Posts: 3
    • View Profile
using namespace
« on: December 18, 2011, 05:14:02 pm »
hey,

i'm not a C++ expert, i don't know any tricks of the trade or anything beyond what you read in the books. what i'd like to know is, reading the tutorials, is it alright for me to use a namespace for sfml? why isn't it used in the tutorials, is it bad practice? does it colide with standard libraries?

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
using namespace
« Reply #1 on: December 18, 2011, 05:25:11 pm »
Generally, good practice is to use sf:: before SFML identifiers. This makes clear to what library a function, type or object belongs, and avoids potential name collisions.

You should write using namespace carefully, and never in headers (because it pollutes the global namespace of all the files including the header).
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development: