Compiler switches in the source code

Á

Ágoston Bejó

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
 
V

Victor Bazarov

Ágoston Bejó said:
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.*
 
T

Thomas Matthews

Ágoston Bejó said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,820
Latest member
GilbertoA5

Latest Threads

Top