Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gcc compiler __SIZE_TYPE__

Tags:

c

gcc

size-type

I'm curious about the variable __SIZE_TYPE__ which is predefined by gcc compiler.

Suppose that I coded like following sentence in C

typedef __SIZE_TYPE__ size_t; 

Is there any possibility that an error occurs when I use another C compiler excluding gcc? Do all C compilers have the variable __SIZE_TYPE__?

like image 503
Hyun Ho Yeo Avatar asked Apr 26 '16 06:04

Hyun Ho Yeo


1 Answers

Yes, it is possible that an error occurs as soon as you use any identifier with double underscore. See the C standard 7.1.3:

All identifiers that begin with an underscore and either an uppercase letter or another underscore are always reserved for any use.

As for __SIZE_TYPE__ that's apparently a gcc identifier. I don't think any other compiler uses it, but there are no guarantees. Another compiler is perfectly free to use the same identifier even for an entirely different purpose.

like image 175
Lundin Avatar answered Nov 01 '22 14:11

Lundin