Compiler switches in the source code

Discussion in 'C++' started by Ágoston Bejó, Oct 28, 2003.

  1. Hi there,
    In the old Pascal-times, you could set compiler switches in the source code,
    with a syntax like {$G+}, things like that (I don't remember them accurately
    anymore).
    Is there something similar with C++ compilers, e.g. to set the /GX switch
    (unwind semantics for exception handling) on and off? This is what I mean if
    it is still not clear:
    // {GX+}
    void funcWithExcHandling() {...}
    // {GX-}
    void funcWithoutExcHandling() {...}

    Yeah, and one more question: Is there a newsgroup specifically for MS Visual
    C++ compilers?

    Thx,
    Guszti
     
    Ágoston Bejó, Oct 28, 2003
    #1
    1. Advertising

  2. "Ágoston Bejó" <> wrote...
    > Hi there,
    > In the old Pascal-times, you could set compiler switches in the source

    code,
    > with a syntax like {$G+}, things like that (I don't remember them

    accurately
    > anymore).
    > Is there something similar with C++ compilers, e.g. to set the /GX switch
    > (unwind semantics for exception handling) on and off? This is what I mean

    if
    > it is still not clear:
    > // {GX+}
    > void funcWithExcHandling() {...}
    > // {GX-}
    > void funcWithoutExcHandling() {...}


    If there is, it's compiler-specific.

    > Yeah, and one more question: Is there a newsgroup specifically for MS

    Visual
    > C++ compilers?


    microsoft.public.vc.*
     
    Victor Bazarov, Oct 28, 2003
    #2
    1. Advertising

  3. Ágoston Bejó wrote:

    > Hi there,
    > In the old Pascal-times, you could set compiler switches in the source code,
    > with a syntax like {$G+}, things like that (I don't remember them accurately
    > anymore).
    > Is there something similar with C++ compilers, e.g. to set the /GX switch
    > (unwind semantics for exception handling) on and off? This is what I mean if
    > it is still not clear:
    > // {GX+}
    > void funcWithExcHandling() {...}
    > // {GX-}
    > void funcWithoutExcHandling() {...}


    In C++, they are called "pragmas". The usage is:
    #pragma {compiler specific directive}

    Note that there are no standard arguments to #pragma directives. These
    preprocessing directives are meant as a tool to pass information to the
    compiler. Also, the arguments of a #pragma may have one meaning to
    one compiler, and a whole different meaning to another.

    If the compiler doesn't understand the #pragma arguments, the directive
    is ignored.


    >
    > Yeah, and one more question: Is there a newsgroup specifically for MS Visual
    > C++ compilers?


    Yes. Read the C++ FAQ and Welcome.Txt below.

    >
    > Thx,
    > Guszti
    >
    >



    --
    Thomas Matthews

    C++ newsgroup welcome message:
    http://www.slack.net/~shiva/welcome.txt
    C++ Faq: http://www.parashift.com/c -faq-lite
    C Faq: http://www.eskimo.com/~scs/c-faq/top.html
    alt.comp.lang.learn.c-c++ faq:
    http://www.raos.demon.uk/acllc-c /faq.html
    Other sites:
    http://www.josuttis.com -- C++ STL Library book
     
    Thomas Matthews, Oct 28, 2003
    #3
    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:
    2
    Views:
    490
  2. Thomas Koch

    Using Trace and Switches in ASP.NET

    Thomas Koch, Jan 27, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    592
    Thomas Koch
    Jan 28, 2004
  3. Peter Forthmann

    Intel 8.0 compiler optimization switches

    Peter Forthmann, Jan 31, 2004, in forum: C++
    Replies:
    1
    Views:
    443
    Jack Klein
    Jan 31, 2004
  4. frank

    more compiler switches

    frank, Jan 23, 2010, in forum: C Programming
    Replies:
    17
    Views:
    554
    frank
    Jan 27, 2010
  5. mathog
    Replies:
    8
    Views:
    604
    Nobody
    May 5, 2012
Loading...

Share This Page