How to positively detect if rtti is enabled or not

Jonathan Wakely jwakely.gcc@gmail.com
Wed Jun 19 19:03:00 GMT 2019


On Wed, 19 Jun 2019 at 20:00, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
>
> On Wed, 19 Jun 2019, 19:07 ba58smith, <ba58smith@gmail.com> wrote:
> >
> > @Marc Glisse-6,
> >
> > Thanks for that, but can you provide a little more info, please? I'm to
> > create a text file called empty.cc, and its contents should be:
>
>
> No, create an EMPTY file. With no contents. Then run the commands Marc
> showed you, and it will answer your question.
>
>
> >
> > Create an empty file empty.cc, then
> >
> > $ g++ -E -dM e.cc > 1
> > $ g++ -E -dM e.cc -fno-rtti > 2
> > $ diff 1 2
> > 108d107
> > < #define __GXX_RTTI 1
> > 202d200
> > < #define __cpp_rtti 199711
> >
> > Is that right? And then what do I do with it? Sorry - this is way
> > lower-level coding than I'm used to. Thanks.
>
> This is not low-level coding, it's running two g++ commands (with rtti
> enabled and without) and comparing the output.

And the point is to demonstrate that there are two macros defined when
RTTI is enabled, __GXX_RTTI (as Marc said, you got the number of
underscores wrong), and __cpp_rtti.

I have no idea where you got _CPP_RTTI, maybe that's meant to be
__cpp_rtti and you got the number of underscores and capitlization
wrong.



More information about the Gcc-help mailing list