| Topic: |
DEVELOP > c-Plus-Plus |
| User: |
"Rick" |
| Date: |
12 Dec 2007 03:20:50 PM |
| Object: |
#pragma once in ISO standard yet? |
I'm told that "#pragma once" has made it into the ISO standard for
either C or C++. I can't find any reference to that anywhere. If
it's true, do any of you have a reference I can use?
Thanks...
.
|
|
| User: "" |
|
| Title: Re: #pragma once in ISO standard yet? |
13 Dec 2007 06:02:42 AM |
|
|
On Dec 12, 4:20 pm, Rick <reply.in.newsgr...@spam.no> wrote:
I'm told that "#pragma once" has made it into the ISO standard for
either C or C++. I can't find any reference to that anywhere. If
it's true, do any of you have a reference I can use?
Thanks...
I have not heard that it will be included into standard. Just for your
information - "#pragma once" is not recognized by all preprocessors,
so you cannot rely on it in a portable program. It is not supported by
GCC from version 3.4. You can read more by following these links:
http://gcc.gnu.org/ml/gcc/2003-02/msg00294.html
http://lists.apple.com/archives/darwin-development/2003/Feb/msg00084.html
Vlady.
.
|
|
|
| User: "Pete Becker" |
|
| Title: Re: #pragma once in ISO standard yet? |
13 Dec 2007 07:56:59 AM |
|
|
On 2007-12-13 07:02:42 -0500, said:
On Dec 12, 4:20 pm, Rick <reply.in.newsgr...@spam.no> wrote:
I'm told that "#pragma once" has made it into the ISO standard for
either C or C++. I can't find any reference to that anywhere. If
it's true, do any of you have a reference I can use?
Thanks...
I have not heard that it will be included into standard. Just for your
information - "#pragma once" is not recognized by all preprocessors,
so you cannot rely on it in a portable program. It is not supported by
GCC from version 3.4. You can read more by following these links:
http://gcc.gnu.org/ml/gcc/2003-02/msg00294.html
http://lists.apple.com/archives/darwin-development/2003/Feb/msg00084.html
It is not in the C++ standard, nor has it been proposed. Experience
indicates that it's not as useful as it appears at first glance, which
is why GCC dropped it.
--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)
.
|
|
|
| User: "Pete Becker" |
|
| Title: Re: #pragma once in ISO standard yet? |
13 Dec 2007 08:09:15 AM |
|
|
On 2007-12-13 08:56:59 -0500, Pete Becker <pete@versatilecoding.com> said:
It is not in the C++ standard, nor has it been proposed. Experience
indicates that it's not as useful as it appears at first glance, which
is why GCC dropped it.
That is, GCC now considers it "obsolete".
--
Pete
Roundhouse Consulting, Ltd. (www.versatilecoding.com) Author of "The
Standard C++ Library Extensions: a Tutorial and Reference
(www.petebecker.com/tr1book)
.
|
|
|
|
|
|
| User: "Abhishek Padmanabh" |
|
| Title: Re: #pragma once in ISO standard yet? |
12 Dec 2007 10:29:56 PM |
|
|
On Dec 13, 2:20 am, Rick <reply.in.newsgr...@spam.no> wrote:
I'm told that "#pragma once" has made it into the ISO standard for
either C or C++. I can't find any reference to that anywhere. If
it's true, do any of you have a reference I can use?
I am not sure about the standardization. I have N2135 (from
2006-11-06) and it does not say anything about pragma once. Although,
it does say pragma directives cause implementation to behave in an
implementation defined manner. In any case, the standard include
guards are capable of the compile time optimization that pragma once
could do, atleast as in gcc. So, it is not really necessary to use
them instead making them redundant.
.
|
|
|
|

|
Related Articles |
|
|