1801
General / Re: Need help understanding how this code works.
« on: August 30, 2012, 10:23:20 am »
It's not needed but macros(something that was in C so you know it means trouble..) don't respect namespaces so they have to be something extremely ugly/stand out a lot so that you're unlikely to use it in normal code. So include guard usually contain name of file because it's unique but can have even more to be safer. sfml include guards are SFML_filename_HPP
'#define' is 'macro'
the '#ifndef' '#endif' blocks are used to do something called 'conditional compilation'
macros and #ifndef #endif blocks used like that are called 'include guards'
In vc++ you can use #pragma once (it works a bit differently and supposedly faster during compilation than include guards but in the end the effect is same) at the beggining of a header but it's not guaranteed to be on every compiler.
'#define' is 'macro'
the '#ifndef' '#endif' blocks are used to do something called 'conditional compilation'
macros and #ifndef #endif blocks used like that are called 'include guards'
In vc++ you can use #pragma once (it works a bit differently and supposedly faster during compilation than include guards but in the end the effect is same) at the beggining of a header but it's not guaranteed to be on every compiler.