Bug 47823 - #pragma once is documented in a weird spot
Summary: #pragma once is documented in a weird spot
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: preprocessor (show other bugs)
Version: 4.5.2
: P3 minor
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: documentation
Depends on:
Reported: 2011-02-20 15:14 UTC by Olaf van der Spek
Modified: 2012-01-28 19:01 UTC (History)
0 users

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2012-01-28 00:00:00


Note You need to log in before you can comment on or make changes to this bug.
Description Olaf van der Spek 2011-02-20 15:14:25 UTC
#pragma once appears to be undocumented

Comment 1 Andrew Pinski 2011-02-20 20:40:03 UTC
At one point it was documented in the C preprocessor manual but it is no longer documented there.
Comment 2 Andrew Pinski 2012-01-28 19:01:42 UTC
Confirmed really it is documented but just under #import documentation.  It really should be under its own:
Another way to prevent a header file from being included more than once
is with the @samp{#pragma once} directive.  If @samp{#pragma once} is
seen when scanning a header file, that file will never be read again, no
matter what.

@samp{#pragma once} does not have the problems that @samp{#import} does,
but it is not recognized by all preprocessors, so you cannot rely on it
in a portable program.