#pragma once in ISO standard yet?

Discussion in 'C Programming' started by Rick, Dec 12, 2007.

  1. Rick

    Rick Guest

    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...
    Rick, Dec 12, 2007
    #1
    1. Advertising

  2. Rick <> wrote in
    news::

    >
    > 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
    Tomás Ó hÉilidhe, Dec 12, 2007
    #2
    1. Advertising

  3. Rick

    jacob navia Guest

    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
    jacob navia, Dec 12, 2007
    #3
  4. Rick

    Tor Rustad Guest

    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 < | tr i-za-h a-z>
    Tor Rustad, Dec 12, 2007
    #4
  5. > 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 <> 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
    Peter Nilsson, Dec 13, 2007
    #5
  6. Rick

    CBFalconer Guest

    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
    CBFalconer, Dec 13, 2007
    #6
  7. Rick

    CBFalconer Guest

    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
    CBFalconer, Dec 13, 2007
    #7
  8. 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. ...

    > >
    > > 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
    Peter Nilsson, Dec 13, 2007
    #8
  9. Rick

    Ian Collins Guest

    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.
    Ian Collins, Dec 13, 2007
    #9
  10. 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".
    Martin Ambuhl, Dec 13, 2007
    #10
  11. Rick

    Chris Hills Guest

    In article <>, CBFalconer
    <> writes
    >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:


    Bearing in mind that an N document is NOT an ISO standard and the
    contents of an N document could change completely en route to an ISO
    standard.

    It probably won't but.......

    --
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
    /\/\/ www.phaedsys.org \/\/\
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    Chris Hills, Dec 13, 2007
    #11
  12. Rick

    James Kuyper Guest

    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.


    It's not in my copy. What's the precise name of the document you're
    using, and which section is it that describes #pragma once?
    James Kuyper, Dec 13, 2007
    #12
  13. Rick

    James Kuyper Guest

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


    I don't see "#pragma once" anywhere in that list. If my eyes are
    deceiving me, could you do something to make the location of the word
    "once" more obvious?
    James Kuyper, Dec 13, 2007
    #13
  14. Rick

    CBFalconer Guest

    Martin Ambuhl wrote:
    > 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".


    I extracted all occurences of "#pragma" in N869 in another
    article. If you really want the " once" part it is missing, but
    the data is there.

    --
    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
    CBFalconer, Dec 13, 2007
    #14
  15. Rick

    CBFalconer Guest

    Chris Hills wrote:
    > <> writes
    >> 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:

    >
    > Bearing in mind that an N document is NOT an ISO standard and the
    > contents of an N document could change completely en route to an ISO
    > standard.


    This didn't and doesn't change.

    --
    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
    CBFalconer, Dec 13, 2007
    #15
  16. Rick

    CBFalconer Guest

    James Kuyper wrote:
    >
    > 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
    > > 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

    >
    > I don't see "#pragma once" anywhere in that list. If my eyes are
    > deceiving me, could you do something to make the location of the
    > word "once" more obvious?


    Did you thing that grep would miss such an occurence? It didn't.

    --
    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
    CBFalconer, Dec 13, 2007
    #16
  17. Rick

    Chris Hills Guest

    In article <Ze98j.17605$k22.9226@trnddc02>, James Kuyper
    <> writes
    >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.

    >
    >It's not in my copy. What's the precise name of the document you're
    >using, and which section is it that describes #pragma once?


    He is quoting from N869.txt


    However you have to bare in mind that an N document is NOT an ISO
    standard and the contents of an N document could change completely en
    route to an ISO standard. It probably won't but it might and until it's
    published it is Not "in the standard"

    --
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
    \/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
    /\/\/ www.phaedsys.org \/\/\
    \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    Chris Hills, Dec 13, 2007
    #17
  18. On Thu, 13 Dec 2007 18:23:45 +0000, Chris Hills wrote:
    > In article <Ze98j.17605$k22.9226@trnddc02>, James Kuyper
    > <> writes
    >>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.

    >>
    >>It's not in my copy. What's the precise name of the document you're
    >>using, and which section is it that describes #pragma once?

    >
    > He is quoting from N869.txt


    No, he's not. He didn't quote anything other than jacob navia's message.

    And as far as I can find, N869.txt does not contain any mention of
    #pragma once anyway.
    Harald van Dijk, Dec 13, 2007
    #18
  19. Rick

    Guest

    Chris Hills wrote:
    > In article <Ze98j.17605$k22.9226@trnddc02>, James Kuyper
    > <> writes
    > >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.

    > >
    > >It's not in my copy. What's the precise name of the document you're
    > >using, and which section is it that describes #pragma once?

    >
    > He is quoting from N869.txt


    I didn't see any quotations about "#pragma once", and it's certainly
    not present in my copy of n869.pdf.
    , Dec 13, 2007
    #19
  20. Rick

    Al Balmer Guest

    On Thu, 13 Dec 2007 18:23:45 +0000, Chris Hills <>
    wrote:

    >In article <Ze98j.17605$k22.9226@trnddc02>, James Kuyper
    ><> writes
    >>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.

    >>
    >>It's not in my copy. What's the precise name of the document you're
    >>using, and which section is it that describes #pragma once?

    >
    >He is quoting from N869.txt
    >
    >
    >However you have to bare in mind that an N document is NOT an ISO
    >standard and the contents of an N document could change completely en
    >route to an ISO standard. It probably won't but it might and until it's
    >published it is Not "in the standard"


    Don't worry, "#pragma once" is not in the actual, real, official C99
    standard, either.

    --
    Al Balmer
    Sun City, AZ
    Al Balmer, Dec 13, 2007
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Franck DARRAS
    Replies:
    12
    Views:
    622
    Jim Higson
    Aug 23, 2004
  2. Jacob Jensen

    pragma once

    Jacob Jensen, Apr 3, 2004, in forum: C++
    Replies:
    14
    Views:
    8,525
    Julie
    Apr 5, 2004
  3. Rick
    Replies:
    4
    Views:
    424
    Pete Becker
    Dec 13, 2007
  4. raashid bhatt

    What is #pragma once used for

    raashid bhatt, Mar 27, 2008, in forum: C++
    Replies:
    7
    Views:
    964
    Andy Champ
    Mar 27, 2008
  5. Subrat
    Replies:
    3
    Views:
    780
    James Kanze
    Jul 2, 2008
Loading...

Share This Page