Re: 16-bit int

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

 




Ian Lance Taylor wrote:
On Thu, Aug 9, 2012 at 3:38 PM, Vincent Lefevre <vincent+gcc@xxxxxxxxxx> wrote:

There are many processors I don't know. What I'm interested in is
information like: is there any target that has some given int type
size?

In the GCC source code:

grep INT_TYPE_SIZE gcc/config/*/*.h

There are also a number of out-of-tree gcc ports.

Similar information on them would be interesting too.

Pretty hard to come by, though.  Many out-of-tree ports are
out-of-tree for a reason.


Usually, a regular compiler user just needs to know the size of int on the particular architecture he's working on, not on every processor/OS existing on the wild. So, the simpler is just to run a program like :

#include <stdio.h>
int main()
{
  printf("sizeof int = %d\n", sizeof(int));
}


If someone needs, for some valid reason, that the integer variables be 16-bit wide, the good practice to write clean, portable and maintainable code is to use "int16_t" integer type instead of just "int".

JM

--

 Envoyé de ma machine à écrire.
 ---------------------------------------------------------------



[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