pragma

I

Ian Collins

ramu said:
HI,
Can anyone tell me about pragma? And can u give an example of how
to use it?
Compiler specific, see you documentation. There is no such word as u.
 
K

Kenny McCormack

Compiler specific, see you documentation. There is no such word as u.

Not necessarily. Below I give a 100% ISO-standard C program that uses
'pragma'.

#include <stdio.h>
int main(void) { puts("pragma is an interestingly concept"); }

Now, you may think this is silly, but the fact that is that here in this
ng, we don't have a clue as to what the OP could possibly be talking about,
so my solution is as good as any other take on it.

Could anyone disagree?
 
C

Chris Dollin

Kenny said:
Not necessarily. Below I give a 100% ISO-standard C program that uses
'pragma'.

#include <stdio.h>
int main(void) { puts("pragma is an interestingly concept"); }

Now, you may think this is silly, but the fact that is that here in this
ng, we don't have a clue as to what the OP could possibly be talking
about,
Why?

so my solution is as good as any other take on it.

Could anyone disagree?

Yes.
 
K

Keith Thompson

osmium said:

I wouldn't advise using that article as a source of information about
C's "#pragma". The term "pragma" is a fairly general term for a
compiler directive. The article uses C's "#include" directive as an
example; that's certainly a compiler directive, but it's not a pragma
in the sense that C uses the word.

In C90, the language defines the #pragma construct, but all pragmas
are implementation-defined.

In C99, there are several language defined #pragmas:

#pragma STDC FP_CONTRACT ...
#pragma STDC FENV_ACCESS ...
#pragma STDC CX_LIMITED RANGE ...

where the argument is one of ON, OFF, or DEFAULT. Other #pragmas
starting with "STDC" may appear in future standards; #pragmas not
starting with "STDC" are implementation-defined.

C99 also adds an operator, _Pragma ( string-literal ), which is more
flexible in some cases (it can result from macro expansion, for
example).
 
K

Kenny McCormack

Keith Thompson said:
In C90, the language defines the #pragma construct, but all pragmas
are implementation-defined.

In C99, there are several language defined #pragmas:

Wow. I did not know that. I thought/assumed that pragma was as much
"outside the box" as are the usual suspects (networking, graphics, blah,
blah, blah)

I stand corrected.
 
K

Keith Thompson

Wow. I did not know that. I thought/assumed that pragma was as much
"outside the box" as are the usual suspects (networking, graphics, blah,
blah, blah)

I stand corrected.

For those of you who have killfiled Kenny McCormack, I felt it
necessary to point out that he's posted something sensible.
 
R

Richard Heathfield

Keith Thompson said:
For those of you who have killfiled Kenny McCormack, I felt it
necessary to point out that he's posted something sensible.

One swallow doesn't make a summer. When he starts posting topical, useful
information on a regular basis, that might be a good time for a heads-up to
his killfilers.

You might wish to pass a copy of this article on to your children (or, in
due course, your grandchildren), in case it ever becomes useful.
 
K

Keith Thompson

Richard Heathfield said:
Keith Thompson said:

One swallow doesn't make a summer. When he starts posting topical, useful
information on a regular basis, that might be a good time for a heads-up to
his killfilers.

Sure, I wasn't making any statement about whether or not this might be
the start of a trend.
 

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,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top