cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
#pragma once
#pragma once
Aug 8, 2013 at 8:46am UTC
Filip Cvetko
(48)
What means #pragma once and how is it included with classes?
Aug 8, 2013 at 9:13am UTC
coder777
(8444)
it is a peprocessor directive. It says that the content of the current file is evaluated/compiled only once even if it's included more than once
Aug 8, 2013 at 9:20am UTC
Filip Cvetko
(48)
okay, thank you, but why is it useful?
Aug 8, 2013 at 9:20am UTC
Filip Cvetko
(48)
can you make an example?
Aug 8, 2013 at 9:57am UTC
coder777
(8444)
can you make an example?
No, I don't know how to illustrate 'once'
okay, thank you, but why is it useful?
It shortens the compile time and avoid the error 'multiple definitions' if included more than once within the same file. Like 'include guard':
http://en.wikipedia.org/wiki/Include_guard
http://en.wikipedia.org/wiki/Pragma_once
Topic archived. No new replies allowed.