Re: standard pragma's?

Discussion in 'C Programming' started by Lew Pitcher, Oct 6, 2010.

  1. Lew Pitcher

    Lew Pitcher Guest

    On October 6, 2010 14:13, in comp.lang.c, wrote:

    > Compiler-specific preprocessor features
    >
    > The #pragma directive is a compiler specific directive which compiler
    > vendors may use for their own purposes. For instance, a #pragma is often
    > used to allow suppression of specific error messages, manage heap and
    > stack debugging, etc.
    >
    > C99 introduced a few standard #pragma directives, taking the form
    > #pragma STDC …, which are used to control the floating-point
    > #implementation.
    >
    > // end excerpt from http://en.wikipedia.org/wiki/C_preprocessor
    >
    > K&R II says that pragmas are implementation-specific. I caught this
    > then out of the corner of my eye. Where can I read up on what must have
    > changed?


    In the ISO C'99 standard, of course :)

    Copies of the draft of the standard are readily available; google
    for "ISO-IEC 9989"

    FWIW, here's a copy of the section on the Pragma directive from 9989

    6.10.6 Pragma directive
    Semantics
    1 A preprocessing directive of the form
    # pragma pp-tokensopt new-line
    where the preprocessing token STDC does not immediately follow pragma in
    the directive (prior to any macro replacement)(^152) causes the
    implementation to behave in an implementation-deï¬ned 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.
    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 (^153) 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).

    ^ 152) An 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-deï¬ned; an implementation is permitted to behave
    as if it were the standard pragma, but is not required to.

    ^ 153) See ‘‘future language directions’’ (6.11.8).


    --
    Lew Pitcher
    Master Codewright & JOAT-in-training | Registered Linux User #112576
    Me: http://pitcher.digitalfreehold.ca/ | Just Linux: http://justlinux.ca/
    ---------- Slackware - Because I know what I'm doing. ------
    Lew Pitcher, Oct 6, 2010
    #1
    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. Rick

    #pragma once in ISO standard yet?

    Rick, Dec 12, 2007, in forum: C Programming
    Replies:
    33
    Views:
    1,231
    CBFalconer
    Dec 15, 2007
  2. Rick
    Replies:
    4
    Views:
    432
    Pete Becker
    Dec 13, 2007
  3. Mr. Buffoon

    Re: standard pragma's?

    Mr. Buffoon, Oct 6, 2010, in forum: C Programming
    Replies:
    43
    Views:
    1,402
    Michael Schumacher
    Oct 12, 2010
  4. Joachim Schmitz

    Re: standard pragma's II

    Joachim Schmitz, Oct 13, 2010, in forum: C Programming
    Replies:
    57
    Views:
    1,339
    Keith Thompson
    Nov 9, 2010
  5. Re: standard pragma's II

    , Oct 21, 2010, in forum: C Programming
    Replies:
    31
    Views:
    877
    William Hughes
    Oct 24, 2010
Loading...

Share This Page