Re: __typeof__ (const int)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 16 February 2017 at 13:29, Aurelien Buhrig wrote:
> Hi,
>
> What does control or what is the rule for the type returned by
> __typeof__ (const int) ?

The type of a const int is ... a const int, of course.

I assume you mean integer constant, not "const int".


> On a private target (using newlib-stdint.h), sizeof(__typeof__ (-32768))
> returns 4 but sizeof(__typeof__ (-32767)) returns 2...

This has nothing to do with __typeof__ only to do with the rules of C
that determine the type of an integer constant,  see
http://en.cppreference.com/w/c/language/integer_constant#The_type_of_the_integer_constant

Presumably your private port has a 16-bit int, so -32768 doesn't fit
in int and has a 32-bit type instead. If that's not the case then you
have a bug in the port and it's selecting the wrong type for the
integer constant -32767.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux