[Cs3] #pragma once
Mikhail Nesterenko
mikhail at cs.kent.edu
Fri Jun 12 09:19:30 EDT 2015
CS3 students,
somebody asked about
#pragma once
It is a non-standard (but widely supported by compilers) preprocessor
directive and is an alternative to include guards for protection
against multiple inclusion. It is even considered to speed up
compilation. However, as non-standard its use it discouraged if
writing for portability. For example, google style guide prohibits its
use:
http://google-styleguide.googlecode.com/svn/trunk/cppguide.html?showone=Windows_Code#Windows_Code
However, our textbook seems to use it. clang and g++ seem to compile
it without problems.
Thanks,
--
Mikhail
More information about the cs3
mailing list