EmbeddedRelated.com
Forums

MC9S12 : SCI programming

Started by karel January 2, 2006
KA
To my very limited understanding #PRAGMA is used in C to tell the
compiler some condition which is not default. I can't tell you anything
else. Except I've seen '#pragma asm' in c code to simpilfy expersions
which are easier in asm then c. 

Regards
Malt

Malt wrote:
 >
> To my very limited understanding #PRAGMA is used in C to tell > the compiler some condition which is not default. I can't tell > you anything else. Except I've seen '#pragma asm' in c code to > simpilfy expersions which are easier in asm then c.
The following quote from N869 (draft C standard) is all you know about pragma. The update to this is N1124. Note that pragma is in lower case. Use of pragma seriously harms portability. 6.10.6 Pragma directive Semantics [#1] A preprocessing directive of the form # pragma pp-tokens-opt new-line where the preprocessing token STDC does not immediately follow pragma in the directive (prior to any macro replacement)136) causes the implementation to behave in an implementation-defined manner. The behavior might cause translation to fail or cause the translator or the resulting program to behave in a non-conforming manner. Any such pragma that is not recognized by the implementation is ignored. ____________________ 136An implementation is not required to perform macro replacement in pragmas, but it is permitted except for in standard pragmas (where STDC immediately follows pragma). If the result of macro replacement in a non-standard pragma has the same form as a standard pragma, the behavior is still implementation-defined; an implementation is permitted to behave as if it were the standard pragma, but is not required to. [#2] If the preprocessing token STDC does immediately follow pragma in the directive (prior to any macro replacement), then no macro replacement is performed on the directive, and the directive shall have one of the following forms whose meanings are described elsewhere: #pragma STDC FP_CONTRACT on-off-switch #pragma STDC FENV_ACCESS on-off-switch #pragma STDC CX_LIMITED_RANGE on-off-switch on-off-switch: one of ON OFF DEFAULT Forward references: the FP_CONTRACT pragma (7.12.2), the FENV_ACCESS pragma (7.6.1), the CX_LIMITED_RANGE pragma (7.3.4). -- "If you want to post a followup via groups.google.com, don't use the broken "Reply" link at the bottom of the article. Click on "show options" at the top of the article, then click on the "Reply" at the bottom of the article headers." - Keith Thompson More details at: <http://cfaj.freeshell.org/google/>