Regarding #pragma

Discussion in 'C Programming' started by venkat, May 15, 2007.

  1. venkat

    venkat Guest

    Hi,

    I have come across the a pragma definition " #pragma switch direct ".
    I don't know any thing about pragma's. Even i when i search through
    google not getting exact information. what does pragma does?. what the
    statment "#pragma switch direct" does?.

    Thanks,
    Venkat.
    venkat, May 15, 2007
    #1
    1. Advertising

  2. venkat

    Ian Collins Guest

    venkat wrote:
    > Hi,
    >
    > I have come across the a pragma definition " #pragma switch direct ".
    > I don't know any thing about pragma's. Even i when i search through
    > google not getting exact information. what does pragma does?. what the
    > statment "#pragma switch direct" does?.
    >

    You'll have to look in you compiler's documentation for that one.

    --
    Ian Collins.
    Ian Collins, May 15, 2007
    #2
    1. Advertising

  3. venkat

    Chris Dollin Guest

    venkat wrote:

    > I have come across the a pragma definition " #pragma switch direct ".


    (That's not a pragma definition; it's a /use/.)

    > I don't know any thing about pragma's. Even i when i search through
    > google not getting exact information. what does pragma does?. what the
    > statment "#pragma switch direct" does?.


    Whatever the documentation for the compiler that that code was
    intended to be compiled on says.

    Pragmas are (generally) not portable and their effect is not defined
    by the Standard. Whoever wrote the code was -- I hope -- using an
    implementation that defined what "#pragma switch direct" meant.
    So you need to know what implementation that was, so you can consult
    its documentation (or perhaps the programmer who pragmaed).

    You could hope -- I would -- that all the pragma did was alter
    performance tradeoffs, such as saying "always implement switches
    with direct jump tables, not linear or binary search or the
    built-in swizzy-but-slow ciscy-switch instruction". But until
    you see the documentation, it might mean "the compiled code
    connects the mains power directly though the unearthed casing
    switch", and you should wear rubbur gloves and boots any time
    you run the program.

    --
    Scoring, bah. If I want scoring I'll go play /Age of Steam/.

    Hewlett-Packard Limited Cain Road, Bracknell, registered no:
    registered office: Berks RG12 1HN 690597 England
    Chris Dollin, May 15, 2007
    #3
  4. In article <>,
    venkat <> wrote:

    >I have come across the a pragma definition " #pragma switch direct ".
    >I don't know any thing about pragma's. Even i when i search through
    >google not getting exact information. what does pragma does?. what the
    >statment "#pragma switch direct" does?.


    It does something compiler specific.

    I found -a- definition fairly easily with google; google for
    "#pragma-switch" and it's the first link that mentions #pragma
    in the results text.

    http://techref.massmind.org/techref/piclist/2004/01/31/013744a.txt
    --
    All is vanity. -- Ecclesiastes
    Walter Roberson, May 15, 2007
    #4
  5. venkat

    Chris Dollin Guest

    Ian Collins wrote:

    > venkat wrote:
    >> Hi,
    >>
    >> I have come across the a pragma definition " #pragma switch direct ".
    >> I don't know any thing about pragma's. Even i when i search through
    >> google not getting exact information. what does pragma does?. what the
    >> statment "#pragma switch direct" does?.
    >>

    > You'll have to look in you compiler's documentation for that one.


    (It might not be /his/ compiler that's relevant -- see my other reply.)

    --
    Is it a bird? It is a plane? No, it's: http://hpl.hp.com/conferences/juc2007/
    WARNING. Various parts of this product may be more than one billion years old.

    Hewlett-Packard Limited registered no:
    registered office: Cain Road, Bracknell, Berks RG12 1HN 690597 England
    Chris Dollin, May 15, 2007
    #5
  6. venkat

    Default User Guest

    Chris Dollin wrote:

    > venkat wrote:
    >
    > > I have come across the a pragma definition " #pragma switch direct
    > > ".

    >
    > (That's not a pragma definition; it's a use.)
    >
    > > I don't know any thing about pragma's. Even i when i search through
    > > google not getting exact information. what does pragma does?. what
    > > the statment "#pragma switch direct" does?.

    >
    > Whatever the documentation for the compiler that that code was
    > intended to be compiled on says.
    >
    > Pragmas are (generally) not portable and their effect is not defined
    > by the Standard. Whoever wrote the code was -- I hope -- using an
    > implementation that defined what "#pragma switch direct" meant.
    > So you need to know what implementation that was, so you can consult
    > its documentation (or perhaps the programmer who pragmaed).


    The latest standard did add a few standard pragmas. As the one
    mentioned above doesn't begin with STDC, it is not one of those.




    Brian
    Default User, May 15, 2007
    #6
    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. Replies:
    9
    Views:
    13,857
    Rob Dekker
    Jul 21, 2005
  2. ryang
    Replies:
    1
    Views:
    935
    Wes Groleau
    Apr 11, 2005
  3. Titus A Ducksass
    Replies:
    1
    Views:
    6,016
    Sid Ismail
    Aug 1, 2003
  4. Paul J. Le Genial

    [Q] pragma no-cache : what about the images ?

    Paul J. Le Genial, Mar 14, 2005, in forum: HTML
    Replies:
    5
    Views:
    7,459
  5. Denis Lagno

    Re: pragma

    Denis Lagno, Oct 4, 2003, in forum: C++
    Replies:
    0
    Views:
    412
    Denis Lagno
    Oct 4, 2003
Loading...

Share This Page