LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-23-2010, 11:29 PM   #1
lesca
Member
 
Registered: Sep 2010
Posts: 58

Rep: Reputation: 0
Smile where can I find the declaration of __TYPE_SIZE__ and __cplusplus?


Hello everyone

When I try to find the definition of size_t, I find this line in stddef.h (with Eclipse):
typedef __SIZE_TYPE__ size_t;

This confuses me, and I decide to find the decalaration of __SIZE_TYPE__ , I click on "Open Declaration" but find nothing.

However, when I expand macro it shows:
#define __SIZE_TYPE__ unsigned int

I searched the whole foldes which contains head files, but I couldn't find that file containing that line.

I open the Explore Macro Expansion window and trace its expansion, find there is only one step.

Again, I click on the 'Open Declaration' button which can find macro defined by me, but nothing found.

So, what happend? Where this expansion (#define __SIZE_TYPE__ unsigned int) from?

I searched the Internet, but found nothing.

There is a similar specifier I can't find: __cplusplus.

I am confused now. Please help!

Thanks!

Last edited by lesca; 10-23-2010 at 11:32 PM.
 
Old 10-24-2010, 06:54 AM   #2
JohnGraham
Member
 
Registered: Oct 2009
Posts: 467

Rep: Reputation: 139Reputation: 139
They aren't defined in any header files - they're predefined by the compiler to give code the information about the system it's being compiled for.

To get the exhaustive list of all such predefined macros, run this command-line (this also works with g++):

Code:
gcc -dM -E - < /dev/null
 
1 members found this post helpful.
Old 10-24-2010, 07:13 AM   #3
lesca
Member
 
Registered: Sep 2010
Posts: 58

Original Poster
Rep: Reputation: 0
Thank you very much!

Esp. the way to find out all the pre-definition is very useful!!
 
Old 10-24-2010, 07:13 AM   #4
lesca
Member
 
Registered: Sep 2010
Posts: 58

Original Poster
Rep: Reputation: 0
Thank you very much!

Esp. the way to find out all the pre-definition is very useful!!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
#if defined(__cplusplus) in Kernel ravishekhar.82 Linux - Newbie 4 04-13-2010 07:19 AM
Array declaration? kalleanka Programming 2 11-19-2007 06:27 AM
Verialbe Declaration (21:42) scbops Programming 1 04-20-2006 02:11 AM
char * declaration in c; alaios Programming 19 09-14-2005 09:50 PM
the c declaration kapsikum Programming 3 04-06-2005 02:12 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration