Re: Standard PRAGMAs?
- From: nospam@xxxxxxxxxxxxx (Richard E Maine)
- Date: Tue, 7 Mar 2006 11:29:32 -0800
Joe Krahn <krahn@xxxxxxxxxxxxx> wrote:
compiler directives in common use are behind comment tags like !DEC$ and
are not standardized.
In some case, it is a bit stronger than "not standardized", for reasons
mentioned below.
One definition of pragma is "A standardized form of comment which has
meaning to a compiler."
I think you may have overlooked a subtlety here. In most of the
definitions I have seen, a fundamental point is that a PRAGMA does not
change the actual meaning of the code. That point is in your definition
above, but subtly so. In particular, that's why a pragma can validly be
described as a comment - comments don't change the meaning of the
program. The idea is supposed to be that if you compile the code on a
compiler that doesn't recognize the pragma, the code is still supposed
to be correct.
Now not all "pragmas" (I'm including the things like !DEC$ in the term)
strictly follow this ideal, but it is at least the ideal. When a pragma
strays from this ideal, it can result in code that actually violates the
standard when the praagma is ignored. That's what I was referring to
when I referred to being stronger than "not standardized".
enable/disable strict warnings or errors for the selected standard.
Things along that general line are common cases of proposed pragmas.
Some debugging aids are similar.
One variant is something comparable to an assert. You could consider
that to be a pragma in a way in that an assert should not have any
effect on the meaning of the code if all is well.
adjust compiler optimizations (only general settings)
That's a common one, but...
Options should generally be limited to a whole source file to make it
possible to implement them outside of the actual compiler.
Pragmas used for optimization hints are often far more specific. Namely,
they sometimes give hints about how best to optimize thnigs like
individual DO loops. HPF is a *MAJOR* example of this. Most of HPF can
be considered as optimization hints in some sense; the code will run if
the compiler ignore them all, but it might run a whole lot faster if the
compiler understands and implements them. (Or anyway, that's the
theory).
--
Richard Maine | Good judgment comes from experience;
email: my first.last at org.domain| experience comes from bad judgment.
org: nasa, domain: gov | -- Mark Twain
.
- Follow-Ups:
- Re: Standard PRAGMAs?
- From: Joe Krahn
- Re: Standard PRAGMAs?
- References:
- Standard PRAGMAs?
- From: Joe Krahn
- Standard PRAGMAs?
- Prev by Date: Standard PRAGMAs?
- Next by Date: Re: Variable length/precision formats?
- Previous by thread: Standard PRAGMAs?
- Next by thread: Re: Standard PRAGMAs?
- Index(es):
Relevant Pages
|