Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » __STDC__ always defined in CDT??(Source Parsing)
__STDC__ always defined in CDT?? [message #735594] Wed, 12 October 2011 10:11 Go to next message
Gert.Grossmann is currently offline Gert.GrossmannFriend
Messages: 3
Registered: October 2011
Junior Member
It seems the symbol __STDC__ is always defined while source parsing.
Compiling of the source does not define the symbol __STDC__.

How can I disable this feature?

reproduction (Eclipse Indigo):

1. create a new C or C++ project.
2. create a new file with following content

//#undef __STDC__

#if !__STDC__
#define TEST "TEST"
#endif

"#define TEST" is shown as unreachable. But if you uncomment "#undef __STDC__" the statement is getting reachable ?!

Regards,
Gert
Re: __STDC__ always defined in CDT?? [message #735639 is a reply to message #735594] Wed, 12 October 2011 13:10 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
AFAIK, CDT gets the symbol from the debugger (aka Scanner Discovery). Create an empty source file test.c and call on the command line
gcc -E -P -dD test.c

This will show you the default predefined symbols (for gcc!).


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: __STDC__ always defined in CDT?? [message #735644 is a reply to message #735594] Wed, 12 October 2011 13:10 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 7
Registered: July 2009
Junior Member
AFAIK, CDT gets the symbol from the debugger (aka Scanner Discovery). Create an empty source file test.c and call on the command line
gcc -E -P -dD test.c
This will show you the default predefined symbols (for gcc!).
--
Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
Re: __STDC__ always defined in CDT?? [message #735655 is a reply to message #735644] Wed, 12 October 2011 13:41 Go to previous messageGo to next message
Gert.Grossmann is currently offline Gert.GrossmannFriend
Messages: 3
Registered: October 2011
Junior Member
Sorry, I forgot to tell! I use the Microsoft Visual C++ tool chain with CDT Internal Builder. So gcc is no option for me.

Regards, Gert
Re: __STDC__ always defined in CDT?? [message #735927 is a reply to message #735655] Thu, 13 October 2011 06:47 Go to previous messageGo to next message
Axel Mueller is currently offline Axel MuellerFriend
Messages: 1973
Registered: July 2009
Senior Member
Gert.Grossmann wrote on Wed, 12 October 2011 15:41
Sorry, I forgot to tell! I use the Microsoft Visual C++ tool chain with CDT Internal Builder. So gcc is no option for me.

Regards, Gert

Visual C++ defines __STDC__, too.
http://msdn.microsoft.com/en-us/library/b0084kay(v=vs.80).aspx

You can try to remove the symbol from Project Properties->C/C++ General->Paths and Symbols


Before you ask
- search this forum
- see the FAQ http://wiki.eclipse.org/CDT/User/FAQ
- google
Re: __STDC__ always defined in CDT?? [message #735937 is a reply to message #735927] Thu, 13 October 2011 07:06 Go to previous message
Gert.Grossmann is currently offline Gert.GrossmannFriend
Messages: 3
Registered: October 2011
Junior Member
But Visual C++ does this symbol only define if /Za is on and we're not compiling C++ code.
So this define should depend on compiler switch /Za (switchable via Visual C++ Tool Chain)

Regards, Gert
Previous Topic:pre-build stripping backslashes in SubWCRev cmd
Next Topic:Project repeated under working set
Goto Forum:
  


Current Time: Tue Sep 24 22:36:15 GMT 2024

Powered by FUDForum. Page generated in 0.03747 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top