Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C Programming > #pragma once in ISO standard yet?

Reply
Thread Tools

#pragma once in ISO standard yet?

 
 
Rick
Guest
Posts: n/a
 
      12-12-2007

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...
 
Reply With Quote
 
 
 
 
Tomás Ó hÉilidhe
Guest
Posts: n/a
 
      12-12-2007
Rick <(E-Mail Removed)> wrote in
news:(E-Mail Removed):

>
> 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?



If it's either language it would be C++.

Try asking in comp.std.c++

--
Tomás Ó hÉilidhe
 
Reply With Quote
 
 
 
 
jacob navia
Guest
Posts: n/a
 
      12-12-2007
Rick 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...


No, it is not in the standard. Many compilers implement this
but it is not (yet) standard

--
jacob navia
jacob at jacob point remcomp point fr
logiciels/informatique
http://www.cs.virginia.edu/~lcc-win32
 
Reply With Quote
 
Tor Rustad
Guest
Posts: n/a
 
      12-12-2007
Rick 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?


You have been told wrong for C.

--
Tor <(E-Mail Removed) | tr i-za-h a-z>
 
Reply With Quote
 
Peter Nilsson
Guest
Posts: n/a
 
      12-13-2007
> Rick wrote:
> > I'm told that "#pragma once" has made it into the ISO
> > standard for either C or C++.


Did you mean neither? It isn't in C. I doubt it's in C++.

> > I can't find any reference to that anywhere.


Ask the person who told you to supply evidence.

jacob navia <(E-Mail Removed)> wrote:
> No, it is not in the standard. Many compilers implement
> this but it is not (yet) standard


Because many compilers implement it differently. The normal
include guard mechanism may be klunky, but at least the
programmer always knows _exactly_ what the preprocessor can
and will do with it.

--
Peter
 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      12-13-2007
Rick 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?


For example, from N869.txt:

[1] c:\stds>cat n869.txt | grep -n #pragma
9468: #pragma STDC FP_CONTRACT on-off-switch
9469: #pragma STDC FENV_ACCESS on-off-switch
9470: #pragma STDC CX_LIMITED_RANGE on-off-switch
9588: #pragma listing on "..\listing.dir"
10114: #pragma STDC CX_LIMITED_RANGE on-off-switch
11136: #pragma STDC FENV_ACCESS on-off-switch
11179: #pragma STDC FENV_ACCESS ON
11192: placed invocation of #pragma STDC FENV_ACCESS ON.165)
11208: #pragma STDC FENV_ACCESS ON pragma, and assuming the
11338: #pragma STDC FENV_ACCESS ON
11405: #pragma STDC FENV_ACCESS ON
11526: #pragma STDC FENV_ACCESS ON
12343: #pragma STDC FP_CONTRACT on-off-switch
24253: #pragma STDC CX_LIMITED_RANGE on-off-switch
24349: #pragma STDC FENV_ACCESS on-off-switch
24452: #pragma STDC FP_CONTRACT on-off-switch
25641: #pragma STDC FENV_ACCESS ON
25680: #pragma STDC FENV_ACCESS ON
25752: #pragma STDC FENV_ACCESS ON
26310: #pragma STDC FENV_ACCESS ON
26461: #pragma STDC FENV_ACCESS ON
26514: #pragma STDC FENV_ACCESS ON
26564: #pragma STDC FENV_ACCESS ON
26825: #pragma STDC FP_CONTRACT OFF
26888: #pragma STDC FP_CONTRACT OFF
27783: -- An unrecognized #pragma directive is encountered
28363: -- A non-STDC #pragma preprocessing directive that is
28367: -- A #pragma STDC preprocessing directive does not match
29051: -- The behavior on each recognized non-STDC #pragma
29522: #pragma preprocessing directive, 6.10.6

--
Merry Christmas, Happy Hanukah, Happy New Year
Joyeux Noel, Bonne Annee.
Chuck F (cbfalconer at maineline dot net)
<http://cbfalconer.home.att.net>



--
Posted via a free Usenet account from http://www.teranews.com

 
Reply With Quote
 
CBFalconer
Guest
Posts: n/a
 
      12-13-2007
jacob navia wrote:
> Rick 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?

>
> No, it is not in the standard. Many compilers implement this
> but it is not (yet) standard


Wrong. It is in the C99 standard.

--
Merry Christmas, Happy Hanukah, Happy New Year
Joyeux Noel, Bonne Annee.
Chuck F (cbfalconer at maineline dot net)
<http://cbfalconer.home.att.net>



--
Posted via a free Usenet account from http://www.teranews.com

 
Reply With Quote
 
Peter Nilsson
Guest
Posts: n/a
 
      12-13-2007
CBFalconer <(E-Mail Removed)> wrote:
> jacob navia wrote:
> > Rick 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. ...

> >
> > No, it is not in the standard. Many compilers implement
> > this but it is not (yet) standard

>
> Wrong. It is in the C99 standard.


Chapter and verse, please.

Note the OP is talking specifically about #pragma once, not
merely #pragma.

--
Peter
 
Reply With Quote
 
Ian Collins
Guest
Posts: n/a
 
      12-13-2007
CBFalconer wrote:
> Rick 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?

>
> For example, from N869.txt:
>
> [1] c:\stds>cat n869.txt | grep -n #pragma


What the OP wanted was more like

grep "#pragma" n869.txt | grep once

Which outputs a whole not of nothing....

--
Ian Collins.
 
Reply With Quote
 
Martin Ambuhl
Guest
Posts: n/a
 
      12-13-2007
CBFalconer wrote:
> jacob navia wrote:
>> Rick 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?

>> No, it is not in the standard. Many compilers implement this
>> but it is not (yet) standard

>
> Wrong. It is in the C99 standard.


Since all the C99 standard pragmas begin with
#pragma STDC
it is very difficult for
#pragma once
to be a C99 standard pragma. Would you care to share _where_ in the
standard you think this is? There are only three standard pragmas,
FP_CONTRACT, FENV_ACCESS, and CX_SELECTED_RANGE. None of them is
spelled "once".
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
#pragma once in ISO standard yet? Rick C++ 4 12-13-2007 02:09 PM
Regex to match say char 't' exactly once in a string and no more than once Gancy Perl Misc 4 02-03-2005 02:19 PM



Advertisments