#pragma once in ISO standard yet?

R

Rick

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

Tomás Ó hÉilidhe

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

jacob navia

Rick said:
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
 
T

Tor Rustad

Rick said:
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.
 
P

Peter Nilsson

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

Ask the person who told you to supply evidence.

jacob navia said:
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.
 
C

CBFalconer

Rick said:
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
 
P

Peter Nilsson

CBFalconer said:
Wrong. It is in the C99 standard.

Chapter and verse, please.

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

Ian Collins

CBFalconer said:
Rick said:
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....
 
M

Martin Ambuhl

CBFalconer said:
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".
 
C

Chris Hills

CBFalconer said:
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.......
 
J

James Kuyper

CBFalconer said:
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?
 
J

James Kuyper

CBFalconer said:
Rick said:
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?
 
C

CBFalconer

Martin said:
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.
 
C

CBFalconer

Chris said:
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.
 
C

CBFalconer

James said:
Rick said:
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.
 
C

Chris Hills

James Kuyper said:
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"
 
H

Harald van Dijk

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

Al Balmer

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top