LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   where can I find the declaration of __TYPE_SIZE__ and __cplusplus? (https://www.linuxquestions.org/questions/programming-9/where-can-i-find-the-declaration-of-__type_size__-and-__cplusplus-840084/)

lesca 10-23-2010 11:29 PM

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!

JohnGraham 10-24-2010 06:54 AM

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

lesca 10-24-2010 07:13 AM

Thank you very much!

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

lesca 10-24-2010 07:13 AM

Thank you very much!

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


All times are GMT -5. The time now is 12:52 PM.